A military judge has ruled that a US Army sergeant who spent five years in captivity in Afghanistan after deserting his post should serve no prison time for endangering his comrades.

The judge gave Bowe Bergdahl a dishonourable discharge, reduced his rank to private and said he must forfeit pay equal to $1,000 per month for 10 months.

President Donald Trump tweeted that the sentence was "a complete and total disgrace to our Country and to our Military".

Barack Obama was criticised for trading Taliban prisoners to bring Bergdahl back to the US, and as a presidential candidate, Mr Trump had called for Bergdahl to face stiff punishment.

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

He pleaded guilty to desertion and misbehaviour 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 defence sought to counter that evidence with testimony about Bergdahl's suffering during his captivity, his contributions to military intelligence and survival instruction, and his mental health problems.

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

In closing arguments, defence lawyers argued that he had already suffered enough confinement during five years of brutal captivity.

They asked the judge to give their client a dishonourable discharge and no prison time, and also cited harsh campaign trail criticism by Mr Trump and Bergdahl's mental disorders.

Captain Nina Banks, a defence lawyer, said it would not be justice to rescue Bergdahl from the Taliban "only to place him in a cell" now.

Bergdahl told the sentencing hearing 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 said 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 Major Justin Oshana.

Bergdahl pleaded guilty on October 16.

The 31-year-old, from Hailey, Idaho, was brought home by Mr Obama in 2014 in a swap for five Taliban prisoners at Guantanamo Bay. Mr Obama said at the time the US does not leave its service members on the battlefield.

Republicans roundly criticised Mr Obama, and Mr Trump went further while campaigning for the presidency, repeatedly calling Bergdahl a traitor who deserved serious punishment.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.