A military judge has spared Army Sgt. Bowe Bergdahl for walking off his post in Afghanistan in 2009, slapping him with a dishonorable discharge but no time behind bars.
President Donald Trump, who previously said Bergdahl should be executed for his desertion, said the ruling is a "complete and total disgrace" to the country and the military.
They asked the judge for a dishonorable discharge and no prison time.
He also recommended that Bergdahl be demoted to private and forfeit $US10,000 in pay.
He plead guilty to desertion and misbehavior in front of the enemy. Bergdahl was nervous, clenching both hands as he left the court with his lawyers.
Trump's tweet came about 90 minutes after the sentence was announced. Bergdahl claimed he had left his post in 2009 to walk through the Taliban-filled eastern Afghanistan countryside to a larger United States base to report command problems in his unit. Breaking down, he called abandoning his post a "terrible move" and detailed several unsuccessful escape attempts from his captors.
Prosecutors said the soldier should spend 14 years behind bars for endangering USA troops in Afghanistan.
A dishonourable discharge, given for the most serious offences, typically means a loss of all veteran and military benefits, including healthcare from the Department of Veterans Affairs.
Defence lawyers had argued during Bergdahl's sentencing hearing that he was a young, hardworking soldier who did not understand the full consequences of his actions when he deserted.
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.
Trump has never been a fan of Bergdahl - in March 2017, he called Bergdahl a "dirty, rotten traitor".
Bergdahl, who has said he wanted to report problems in his unit, apologised in court this week for the suffering he caused his comrades and admitted he had made "a disgusting mistake".
Bergdahl suffered from numerous mental illnesses, including schizotypal personality disorder and post-traumatic stress disorder; and Dr. Charles Morgan, a forensic psychiatrist and professor at the University of New Haven and Yale University testified on Wednesday that Bergdahl suffered these problems before enlisting. The judge had wide leeway because Bergdahl made no deal with prosecutors to limit his sentence.