Sgt. Bowe Bergdahl will not serve any prison time for walking off his post in Afghanistan in 2009, a military judge ruled Friday.

The judge, Col. Jeffrey Nance, sentenced Bergdahl to a reduction in rank to private, a payment of $1,000 per month for 10 months and a dishonorable discharge, according to multiple reports.

Nance made no other comments, according to The Associated Press.

Bergdahl, 31, pleaded guilty last month to charges of desertion and misbehavior before the enemy. He faced a maximum sentence of life in prison.

Several reports described Bergdahl as tense or shaking as Nance announced his ruling. Bergdahl grimaced and clenched his jaw, according to the AP, which added his attorneys put their arms around him and one patted him on the back.

Prosecutors had recommended a sentence of 14 years of in prison. Defense attorneys, meanwhile, asked for no prison time, citing Bergdahl’s time in Taliban captivity.

Bergdahl’s lead defense attorney, Eugene Fidell, told reporters outside the courtroom that he’ll appeal the dishonorable discharge.

“Dishonorable discharge is a lifetime stigma, and it deprives him of substantial benefits, which he badly needs,” Fidell said. “Beyond that, if you feel something fundamentally unfair has happened –– and I am talking about President Trump here –– that the judicial process has been distorted for improper, thoughtless reasons that are basically inimical to our way of life, rule of law in country, then you appeal.”

Bergdahl walked off his post in Afghanistan in 2009 and was held captive by the Taliban until 2014 when President Obama made a controversial prisoner swap.

Bergdahl’s defense lawyers twice tried to have the case dismissed over comments from the campaign trail, when Trump repeatedly called Bergdahl a traitor who should be executed.

“We’re tired of Sgt. Bergdahl, who’s a traitor, a no-good traitor, who should have been executed,” Trump said at an October 2015 rally, for example.

“Thirty years ago, he would have been shot,” he added.

Nance ruled Bergdahl can get a fair trial despite Trump’s comments, but said he would consider them as a mitigating factor in the sentencing.

In an emotional sentencing hearing over the past week, prosecutors called soldiers who were seriously injured in the search for Bergdahl. Among those who testified was the wife of a soldier who was shot in the head and suffered a traumatic brain injury that left him unable to speak.

Bergdahl also unexpectedly took the stand and offered a tearful apology for his decision to walk off his post, which he has said he did to alert his superiors to issues at the base.

“My words can’t take away what people have been through,” Bergdahl said last week. “I am admitting I made a horrible mistake.”