Bowe Bergdahl, the US soldier held as a Taliban captive in Afghanistan for five years, has pleaded guilty to desertion and misbehaviour before the enemy.
The 31-year-old Army sergeant entered his plea on Monday before a military judge at Fort Bragg, North Carolina.
The Idaho native’s lawyers have argued he cannot get a fair trial following criticism from Donald Trump during last year’s presidential campaign.
Mr Trump had called him “a no-good traitor who should have been executed”.
When asked during a news conference on Monday whether his comments had any impact on Sgt Bergdahl’s case, the president said he could not comment, but “I think people have heard my comments in the past”.
“We may as well go back to kangaroo courts and lynch mobs,” Sgt Bergdahl said in a 2016 interview that was obtained by ABC News and broadcast on Monday.
In the remarks to British filmmaker Sean Langan, who was himself held captive by the same Taliban group in 2008, Sgt Bergdahl denied he had left his post in order to meet Taliban militants.
“You know, it’s just insulting frankly,” he said. “It’s very insulting, the idea that they would think I did that.”
Sgt Bergdahl, who remains on active duty desk work in San Antonio, Texas, was first charged in 2015, a year after his release.
During Monday’s hearing, he told the court: “I was captured by the enemy against my will.”
“At the time I had no intention of causing search and recovery operations… It’s very inexcusable,” he added.
He is scheduled to face a pre-sentencing hearing starting on 23 October.
The maximum penalty for misbehaviour before the enemy is life in prison, and the maximum sentence for desertion is five years.
Army General Kenneth Dahl, who led the investigation into Sgt Bergdahl’s disappearance, has testified that a jail sentence would be “inappropriate”.
In a podcast interview last year, Sgt Bergdahl said he walked off his combat post to prove to senior officers his commanders were “unfit” for service.
Upon his return to the US, an Army Sanity Board evaluation determined that he had schizotypal personality disorder “at the time of the alleged criminal conduct” and now suffers from post-traumatic stress disorder.
The decision to exchange five Taliban captives from Guantanamo Bay in order to secure Sgt Bergdahl’s release was heavily criticised by Republican lawmakers as contrary to US policy of not negotiating with terrorists.
Several former platoon mates have alleged US soldiers were killed or wounded during the frantic 45-day search for the 501st Parachute Infantry Regiment trooper.
The judge has allowed wounded servicemen to testify that they were hurt because of the search for Sgt Bergdahl.
Much of Sgt Bergdahl’s captivity was spent in a “cage”, he said, and he was extensively tortured by his captors, a military expert has previously testified.
During Mr Trump’s presidential campaign, he called Sgt Bergdahl “garbage” and suggested he should be summarily executed.
“You know in the old days – bing, bong,” Mr Trump said at a campaign rally as he imitated firing a gun. “When we were strong.”
The interview with Bowe Bergdahl will be on BBC’s Newsnight at 2230 BST on Monday