FORT BRAGG, N.C. — Sgt. Bowe Bergdahl, who walked off his Army base in Afghanistan in 2009 and was held captive by the Taliban for five years, received no prison time for desertion or endangering troops, but was ordered by a military judge on Friday to be dishonorably discharged from the Army.
The sentencing took only minutes in a case where prosecutors had sought 14 years in a military prison.
The military judge, Col. Jeffery R. Nance of the Army, also reduced Sergeant Bergdahl’s rank to private and required him to forfeit $1,000 a month of his pay for 10 months.
President Trump, who has labeled Sergeant Bergdahl a “dirty rotten traitor,” called Friday’s sentence “a complete and total disgrace to our Country and to our Military.”
Colonel Nance did not explain his reasoning for the sentence, which will be reviewed by Gen. Robert B. Abrams, who convened the court-martial and has the power to lessen the punishment. If the final sentence still includes a punitive discharge, it will automatically be reviewed by the United States Army Court of Criminal Appeals.
The case has been dogged by politics and controversy from beginning to end.
After trading Sergeant Bergdahl for five Taliban detainees in 2014, the Obama administration embraced him, with the national security adviser, Susan E. Rice, even saying he had served with “honor and distinction.” But the prisoner swap, and the sergeant’s portrayal, angered many Republicans. Senator John McCain even threatened to hold a hearing if the sergeant was not punished.
Last year, Mr. Trump made denunciations of Sergeant Bergdahl a staple of his campaign speeches, repeatedly calling for him to be executed.
Ironically, Mr. Trump’s comments may have contributed to the decision not to sentence him to prison. After Mr. Trump seemed last month to endorse his harsh criticism from the campaign trail, Colonel Nance ruled that he would consider the comments as mitigating evidence at sentencing.
With the sentence still facing review by General Abrams and military appellate judges, Mr. Trump’s post-verdict comments on Twitter seemed to bolster efforts by the defense to have the sentence thrown out on appeal, some military law experts said, on the grounds that the president had unlawfully influenced the case.
“Trump just exponentially increased Bergdahl’s chances of getting this whole case tossed on appeal,” said Rachel VanLandingham, a professor at Southwestern Law School in Los Angeles and a retired Air Force lawyer.
The tweet could be interpreted as an effort to pressure officers who still have some control over the sergeant’s fate not to reconsider his sentence, military law experts said.
Sergeant Bergdahl’s chief defense lawyer, Eugene R. Fidell, called the sentence “a tremendous relief” and said his client was still absorbing it.
Standing outside the military courthouse here, Mr. Fidell, who teaches military justice at Yale Law School, then took sharp aim at the commander in chief.
“President Trump’s unprincipled effort to stoke a lynch-mob atmosphere while seeking our nation’s highest office has cast a dark cloud over the case,” he said. “Every American should be offended by his assault on the fair administration of justice and disdain for basic constitutional rights.”
Even though the defense had told the judge that a dishonorable discharge would be appropriate, Mr. Fidell said he hoped that it would be overturned. He noted that such a discharge would deprive his client of health care services and other “benefits he badly needs” from the Department of Veterans Affairs.
Sergeant Bergdahl is expected to return to an Army base as the case winds through the appeals process.
Sergeant Bergdahl was 23 and a private first class when he left his base in eastern Afghanistan in June 2009. Army investigators would later characterize his departure as a delusional effort to hike to a larger base and cause enough of a stir that he would get an audience with a senior officer to report what he felt were problems in his unit.
But the soldier, who is now 31, was captured by the Taliban within hours and spent five years as a prisoner, his treatment worsening after every attempt to escape. He was beaten with copper cables and held in isolation in a metal cage less than seven feet square. He suffered dysentery for most of his captivity, and cleaned feces off his hands with his own urine so that he could eat enough bread to survive.
The military searched for him, and several troops were wounded during those missions. One of them, Sgt. First Class Mark Allen, was shot through the head and lost the ability to walk, talk or take care of himself, and now has minimal consciousness. His wife, Shannon, testified that he is not even able to hold hands with her anymore. On a separate rescue mission, Senior Chief Petty Officer Jimmy Hatch, a Navy SEAL, suffered a leg wound that required 18 surgical procedures and ended his long career in special operations.
Army investigators quickly dismissed claims that troops had died searching for Sergeant Bergdahl — who was promoted during captivity — or that he had intended to defect to the Taliban. They suggested that he could be prosecuted for desertion and for some lesser crimes. But in March 2015, the Army raised the stakes, accusing him not only of desertion but also of misbehavior before the enemy, an ancient but rarely charged crime punishable by up to life in prison. In this case, the misbehavior was endangering the troops sent to search for him.