FORT BRAGG, N.C. (AP) — A military judge ruled Friday that Bowe Bergdahl should serve no prison time for endangering his comrades by walking off his Afghanistan post.

The sentence caps a politically divisive episode that centered on one soldier's decision that affected many other lives. President Barack Obama was criticized for trading Taliban prisoners to bring him back. As a presidential candidate, Donald Trump had called for Bergdahl to face stiff punishment.

The judge also gave Bergdahl a dishonorable discharge, reduced his rank to private and said he must forfeit pay equal to $1,000 per month for 10 months. The judge made no other comments.

Bergdahl appeared tense, grimaced and clenched his jaw. His attorneys put their arms around him and one patted him on the back.

Bergdahl pleaded guilty to desertion and misbehavior before the enemy and had faced up to life in prison. The judge had wide leeway because Bergdahl made no deal with prosecutors to limit his sentence.

Prosecutors had sought stiff punishment because of wounds to service members who searched for Bergdahl after he disappeared in 2009. He was held captive by Taliban allies for five years.

The defense sought to counter that evidence with testimony about Bergdahl's suffering during five years as a captive of Taliban allies, his contributions to military intelligence and survival instruction and his mental health problems.

A punitive discharge deprives Bergdahl of most or all his veterans' benefits.

Bergdahl had faced up to life in prison after pleading guilty to desertion and misbehavior before the enemy.

In closing arguments, defense attorneys argued Bergdahl already suffered enough confinement during five years of brutal captivity by Taliban allies. They asked the judge to give their client a dishonorable discharge and no prison time. Their argument for leniency also cited harsh campaign-trail criticism by Donald Trump and Bergdahl's mental disorders.

Capt. Nina Banks, a defense attorney, said it wouldn't be justice to rescue Bergdahl from the Taliban "only to place him in a cell" now.

During the multiday sentencing hearing, Bergdahl himself testified that he was sorry for the wounds suffered by searchers. He also described brutal beatings by his captors, illness brought on by squalid conditions and maddening periods of isolation. A psychiatrist testified that his decision to leave his post was influenced by a schizophrenia-like condition called schizotypal personality disorder that made it hard to understand consequences of his actions, as well as post-traumatic stress disorder brought on partly by a difficult childhood.

Prosecutors had asked for a sentence of 14 years in prison, citing serious wounds to service members who looked for Bergdahl.

"Sgt. Bergdahl does not have a monopoly on suffering as a result of his choices," said Maj. Justin Oshana, a prosecutor.

Bergdahl pleaded guilty Oct. 16. The judge has wide discretion on sentencing because Bergdahl didn't strike a deal with prosecutors to limit his punishment.

The 31-year-old soldier from Hailey, Idaho, was brought home by Obama in 2014 in a swap for five Taliban prisoners at Guantanamo Bay. Obama said at the time 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 traitor who deserved serious punishment.

More From News Radio 1310 KLIX