RALEIGH, N.C. — Army Sgt. Bowe Bergdahl will appear Monday before the judge deciding his punishment for endangering comrades by walking off his post in Afghanistan in 2009.

Bergdahl faces up to life in prison after pleading guilty last week to desertion and misbehavior before the enemy.

Bergdahl pleaded guilty without striking a deal with prosecutors to cap his punishment, so the judge has wide leeway to decide his sentence.

The judge, Army Col. Jeffery R. Nance, is expected to weigh factors including Bergdahl’s willingness to admit guilt, his captivity by the Taliban and its allies and serious wounds to service members who searched for him.

Prosecutors are expected to put on evidence or testimony about soldiers and a Navy SEAL who were seriously wounded by gunfire during separate search missions.

Nance will also have to resolve a last-minute argument by the defense that new comments by President Trump have tainted the case.

Bergdahl, who’s from Hailey, Idaho, was captured and held by the Taliban and its allies for five years after he walked off his remote post in 2009.

President Obama brought him home in 2014 in a swap for five Taliban prisoners at Guantanamo Bay, saying the U.S. does not leave its service members on the battlefield.

Republicans roundly criticized Obama, and Trump went further while campaigning for president, repeatedly calling Bergdahl a “dirty, rotten traitor” who deserved to be executed by firing squad or thrown out of a plane without a parachute.

Bergdahl, 31, has said he walked away from his post with the intention of reaching other commanders and drawing attention to what he saw as problems with his unit. Still, when he pleaded guilty, he told the judge that his actions were inexcusable.

The defense was previously rebuffed in efforts to show that Trump had tainted the case with his scathing campaign-trail criticism, when the judge ruled in February it didn’t amount to unlawful command influence.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.