FORT BRAGG, N.C. (AP) — Army Sgt. Bowe Bergdahl's guilty plea to charges of endangering comrades in Afghanistan has set up a dramatic sentencing hearing that could land him in prison for life.

Bergdahl, who was captured and held by the Taliban for five years after leaving his remote post in Afghanistan in 2009, pleaded guilty Monday in North Carolina to desertion and misbehavior before the enemy, a rare charge that carries a potential life sentence.

Because Bergdahl had no plea deal with prosecutors, his punishment will be decided by the judge, Army Col. Jeffery R. Nance, at a hearing starting Oct. 23.

Bergdahl was thoroughly questioned by Nance at his plea hearing at Fort Bragg, and the soldier acknowledged that his actions — and subsequent military search missions — put fellow service members in harm's way.

"I left my fellow platoon mates," he told the judge. "That's very inexcusable."

At sentencing, the judge is expected to weigh factors including Bergdahl's willingness to accept responsibility by pleading guilty, his time in captivity of the Taliban and its allies, and serious wounds to service members who searched for him.

Army Sgt. Bowe Bergdahl pleaded guilty Monday to charges that he endangered comrades by walking away from a remote post in Afghanistan in 2009. The 31-year-old Bergdahl entered the plea without a deal with prosecutors to limit his punishment. (Oct. 16)

"Pleading guilty before a judge without any protection from a deal is a risky move," said Eric Carpenter, a former Army lawyer who teaches law at Florida International University. "The military judge can sentence Bergdahl to zero punishment, but he can also sentence Bergdahl to life in prison."

The guilty plea brings the highly politicized saga closer to an end eight years after Bergdahl vanished.

President Barack Obama brought him home in 2014 in a swap for five Taliban prisoners at Guantanamo Bay, saying the U.S. does not leave its service members on the battlefield. Republicans roundly criticized Obama, and Donald Trump went further while campaigning for president, repeatedly calling Bergdahl a "dirty, rotten traitor" who deserved to be executed by firing squad or thrown out of a plane without a parachute.

Bergdahl, 31, has said he walked away from his remote post in 2009 with the intention of reaching other commanders and drawing attention to what he saw as problems with his unit.

"At the time, I had no intention of causing search-and-recovery operations," he said in court. "I believed they would notice me missing, but I didn't believe they would have reason to search for one private."

Bergdahl was promoted while in captivity, like all soldiers who are missing in action. But the Hailey, Idaho, native became the subject of a military probe the moment he was freed, and has been assigned to desk duty at a Texas Army base in the meantime.

Bergdahl's responses to the judge Monday were some of his most extensive public comments yet.

He said he tried to escape from his captors 12 to 15 times, with varying degrees of success. Once, he was on his own for about a week — hoping U.S. drones would spot him — before he was recaptured. He said he also tried to escape on his first day in captivity.

"As I started running there came shouts, and I was tackled by people. That didn't go so well," said Bergdahl, who spoke in even tones and wore a blue dress uniform.

Meanwhile, Bergdahl's fellow service members engaged in firefights that they could have avoided had Bergdahl not gone absent without leave, the judge said. Those firefights left a Navy SEAL with a career-ending leg wound and an Army National Guard sergeant with a head wound that put him in a wheelchair.

As for the defense contention that Trump unfairly biased the court-martial against Bergdahl, a ruling in February found that the new president's comments were "disturbing and disappointing" but did not constitute unlawful influence by the soon-to-be commander in chief.

___

Follow Drew at www.twitter.com/jonldrew .