Army Sgt. Bowe Bergdahl pleaded guilty Monday at Fort Bragg to charges he endangered comrades by walking away from his post in Afghanistan in 2009 -- the court case wrapping up three years after a stunning Rose Garden spectacle in which former President Barack Obama, flanked by Bergdahl's parents, triumphantly announced the soldier's release from captivity.

"I understand that leaving was against the law," said Bergdahl, whose decision to walk off his remote post in Afghanistan in 2009 prompted intense search and recovery missions, during which some of his comrades were seriously wounded and other soldiers died.

"At the time, I had no intention of causing search and recovery operations," Bergdahl said, but he added he now understand that his decision prompted efforts to find him.

Bergdahl told the judge he left his post because he had issues with his command and was trying to travel to another base to notify them -- a claim that has been disputed in the past by a former platoon mate. He added he got lost after 20 minutes and was captured hours later.

The misbehavior charge carries a maximum penalty of life in prison, while the desertion charge is punishable by up to five years behind bars.

Bergdahl also claimed Monday he escaped around 12 to 15 times while he was being held by the Taliban, with one instance lasting eight days, until he was re-captured by his captors.

It wasn't immediately clear whether his defense has conceded that he's responsible for a long chain of events that his desertion prompted, which included many decisions by others on how to conduct the searches. Despite his plea, the prosecution and defense have not agreed to a stipulation of facts, said one of his lawyers, Maj. Oren Gleich, according to The Associated Press.

Another one of Bergdahl's lawyers, when reached by Fox News, said "no comment."

Bergdahl, 31, was released in May 2014 after a highly-criticized deal in which five Taliban terrorists were set free. At the time, Obama administration officials said Bergdahl had "served with honor and distinction."

The U.S. Army said Bergdahl asked to enter his plea before the military judge. Obama was criticized by Republicans for the 2014 Taliban prisoner swap that brought Bergdahl home, while President Donald Trump harshly criticized Bergdahl on the campaign trail.



Bergdahl's punishment won't be known until after the judge, Army Col. Jeffery R. Nance, holds the sentencing hearing that's expected to start on Oct. 23. Bergdahl, who's from Hailey, Idaho, previously chose to have his case heard by a judge alone, rather than a jury.

BERGDAHL DECLARED JIHAD IN CAPTIVITY, DOCUMENTS SHOW

Serious wounds to service members who searched for Bergdahl are expected to play a role in his sentencing. While guilty pleas would allow him to avoid a trial, he'd still face a sentencing hearing in late October. Bergdahl's five years of captivity by the Taliban and its allies also will likely play a role in what punishment he receives.

At one point during his captivity, Bergdahl converted to Islam, fraternized openly with his captors and declared himself a "mujahid," or warrior for Islam, Fox News reported in 2014, citing secret documents prepared on the basis of a purported eyewitness account.

The reports indicate that Bergdahl's relations with his Haqqani terrorist network captors morphed over time, from periods of hostility, where he was treated very much like a hostage, to periods where, as one source told Fox News, "he became much more of an accepted fellow" than is popularly understood. He even reportedly was allowed to carry a gun at times.

Bergdahl also collected contact information and talked about becoming a mercenary in what his squad mates described as behavior that laid the groundwork for his disappearance, Fox News reported a year later.

He was apparently “high” with a small group of Afghan soldiers when they were picked up by nomads in 2009, according to a former CIA operative who was running a network of informants on the ground. The former CIA operative told Fox News Bergdahl was captured along with others, and sold to the Haqqani network in Pakistan within four days.

SEAL, SOLDIER INJURIES IN BERGDAHL HUNT TO BE FOCUS OF HEARING

Legal scholars have said several pretrial rulings against the defense have given prosecutors leverage to pursue stiff punishment against Bergdahl, The Associated Press reported. Perhaps most significant was the judge's decision in June to allow evidence of serious wounds to service members who searched for Bergdahl at the sentencing phase. The judge ruled a Navy SEAL and an Army National Guard sergeant wouldn't have wound up in separate firefights that left them wounded if they hadn't been searching for Bergdahl.

“We may as well go back to kangaroo courts and lynch mobs that got what they wanted,” Bergdahl said to a British filmmaker in 2016 when asked about trials, according to an interview obtained by ABC News. “The people who want to hang me, you’re never going to convince those people.”

Defense attorneys have acknowledged Bergdahl walked off his base without authorization. Bergdahl himself told a general during a preliminary investigation that he left intending to cause alarm and draw attention to what he saw as problems with his unit. He was soon captured.

Fox News' Terace Garnier, Brooke Singman and The Associated Press contributed to this report.