FORT BRAGG, N.C. — Army Sgt. Bowe Bergdahl, who abandoned his post in Afghanistan and was held captive for five years by the Taliban, was charged Wednesday by the U.S. military with desertion and misbehavior before the enemy and could get life in prison if convicted.

The charges are the latest development in a long and bitter debate over Bergdahl’s case. They also underscore the military and political ramifications of his decision on June 30, 2009, to leave his post after expressing misgivings about the U.S. military’s role, as well as his own, in the Afghanistan war.

Bergdahl, 28, was captured by the Taliban and held by members of the Haqqani network, an insurgent group tied to the Taliban that operates both in Pakistan and Afghanistan.

Last May 31, Bergdahl was handed over to U.S. special forces in Afghanistan as part of an exchange for five Taliban commanders who were imprisoned at Guantanamo Bay, Cuba.

The exchange set off a debate over whether the U.S. should have released the five Taliban members. Little is known about what the five have been doing in Qatar, where they are being monitored by the government. Some lawmakers have predicted that the five would return to the battlefield.

Wednesday’s announcement brought further criticism of the exchange from some lawmakers, including U.S. Rep. Michael McCaul, R-Texas and the chairman of the Committee on Homeland Security.

“President Obama endangered our national security and broke the law when he chose to negotiate with terrorists and release hardened enemy combatants from Guantanamo Bay in exchange for Sgt. Bergdahl — who many believed at the time was a deserter,” McCaul said in a statement.

The Obama administration appeared to stand by the swap.

“Was it worth it? Absolutely. We have a commitment to our men and women serving overseas, or in our military, defending our national security every day, that we will do everything we can to bring them home, and that’s what we did in this case,” State Department spokeswoman Jen Psaki said in an interview on Fox News.

The misbehavior charge could land Bergdahl in prison for life, though some legal experts said a lengthy sentence was unlikely. He also could be dishonorably discharged and forfeit all his pay if convicted on either charge.

Next, an Article 32 hearing — similar to a civilian grand jury proceeding — will be held at Fort Sam Houston in San Antonio, where Bergdahl has been performing administrative duties. A date was not announced. From there, it could be referred to a court-martial and go to trial.

His attorney did not immediately respond to a request for comment.

After a lengthy investigation that included interviewing unit members and commanders and meetings with Bergdahl and his attorney, the case was referred to Gen. Mark Milley, who had a broad range of legal options.

Milley could have decided not to charge Bergdahl at all, recommend administrative action or convene a court-martial on more serious offenses.

Bergdahl also could have faced more serious desertion charges, though this charge does not require prosecutors to prove that he had no intention of returning to his unit.

It was unlikely that prosecutors would have sought a desertion charge that carried a possible death penalty after American lives and Taliban prisoners were exchanged to get Bergdahl back, said Jeffrey K. Walker, a St. John’s University law professor, retired Air Force officer and former military lawyer.

Still, the military could have a tough case to make, said former Army lawyer Greg Rinckey.

“It’s tough to prove beyond a reasonable doubt, especially if you have someone that’s been gone for five years and potentially may have some mental health issues at the time that the defense is going to bring up,” Rinckey said.

The misbehavior charge is rarely seen in military cases, typically reserved for shameful or cowardly conduct, said Daniel Conway, a military defense lawyer and the author of a forthcoming book on military crimes.

Conway said he wouldn’t expect the Army to seek much prison time for Bergdahl because of his time as a Taliban captive, but officials needed to prosecute the case because a conviction means Bergdahl cannot collect special compensation as a prisoner of war.

“He did spend X number of years as a prisoner of the Taliban — that certainly mitigates the need for him to be locked up,” Conway said. “But as a political matter, I don’t think we can stomach the possibility that he deserted his post and could receive $300,000 in back pay for it.”

Some within the military have suggested that Bergdahl’s long capture was punishment enough, but others, including members of his former unit, have called for serious punishment, saying that other service members risked their lives — and several died — searching for him.

One of those in Bergdahl’s platoon, Cody Full, 26, of Houston, said Bergdahl should be stripped of all his pay and benefits and be dishonorably discharged.

“It’s not fair for guys that served honorably and didn’t desert, that go to college on the GI Bill or get their retirement and other benefits, for them to get it and him to get it as well,” said Full, who is no longer in the military.

He also said Bergdahl should serve a lengthy sentence to send a message to anyone who considers deserting in the future.

“The military’s obviously a very rough job. ... But everybody else stayed with the oath and did what they signed up to do,” Full said. “And as a result of that, some didn’t get to come home.”

———

Baldor reported from Washington. Associated Press writers Donna Cassata, Erica Werner, Deb Riechmann and Sagar Meghani in Washington, Emery P. Dalesio in Raleigh and Gene Johnson in Seattle contributed to this report.