A US soldier captured by the Taliban for five years has pleaded guilty at a military court in North Carolina to desertion and misbehaviour before the enemy.
Army Sergeant Bowe Bergdahl now faces the possibility of life imprisonment.
Who is Bowe Bergdahl?
Sgt Bergdahl was released in March 2015, five years after being captured by Afghan Taliban, in a controversial exchange for five Taliban officials being held at Guantanamo Bay.
The prisoner swap came after secret talks between the US government and the Taliban, brokered by Qatar.
Bergdahl was serving with an Alaska-based infantry regiment in Paktika province near the Pakistani border and went missing on 30 June 2009, five months after being deployed to Afghanistan.
The circumstances of his capture remain murky, with speculation he may have walked away from his base out of disillusionment with the US campaign. In March 2015, he was charged with desertion and misbehaviour before the enemy.
The US believes he was across the frontier in Pakistan for most of his captivity, reportedly held by the Haqqani network, which operates in the Afghanistan-Pakistan border region and is allied to the Afghan Taliban.
What do we know about his disappearance?
The circumstances of Sgt Bergdahl's capture in 2009 remain unclear, although a Pentagon investigation a year later concluded he left his post in Paktika Province without authorisation, according to a Pentagon official at the time.
Several commentators and soldiers branded him a deserter and called for him to be punished.
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".
"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 recently.
The New York Times said on his disappearance in 2009 that he had left military areas before, during a training programme in California and an Afghan outpost, but returned each time.
US officials told the newspaper the report did not conclude whether Sgt Bergdahl had intended to permanently desert the military.
The US military's top-ranking officer, Gen Martin Dempsey, has that the Army would not ignore misconduct but that the soldier, now aged 31, was innocent until proven guilty. "When he is able to provide the facts, we'll learn what happened."
The defence department opened up an investigation into his disappearance and capture, appointing a two-star general with combat experience in Afghanistan to lead the inquiry.
How was he handed over?
Taliban officials say the soldier was handed over near Khost, close to the the Afghan-Pakistan border, on the evening of 31 May. A several-dozen strong US special forces team flew in by helicopter and briefly met some 18 Taliban on the ground.
The exchange, captured on video, shows Sgt Bergdahl sitting in a pick-up truck before being walked to the helicopter.
Once the helicopter was in the air, Bergdahl wrote the letters "SF?" on a paper plate - an abbreviation for special forces - and reportedly broke down when the men responded: "Yes, we've been looking for you for a long time."
Why was he released?
Sgt Bergdahl was the only US soldier being held by the enemy in the Afghan conflict, and Washington had long been seeking his release, spurred on by the "Standing with Bowe" campaign led by his parents in Hailey, Idaho.
Negotiations for the US-Taliban prisoner swap began in 2012 with US and Taliban officials meeting face-to-face in Qatar.
But the talks did not move forward because the US were pushing for a wider peace process, while the Taliban wanted to limit the talks to a prisoner swap, Taliban sources told the BBC.
Direct negotiations broke down in 2014 when the Afghan government opposed the opening of a Taliban office in Qatar, although secret talks continued, mediated by Qatar.
The issue was given more impetus as plans solidified to pull nearly all American forces out of Afghanistan by the end of 2016. US sources say the breakthrough came when hardline Taliban leaders dropped their opposition to a swap.
Who are the Guantanamo detainees?
The exchanged prisoners are Mohammad Fazl, Khirullah Khairkhwa, Abdul Haq Wasiq, Mullah Norullah Noori and Mohammad Nabi Omari.
They were thought in 2015 to be the most senior Afghans still held at Guantanamo, having been captured during America's military campaign in 2001.
Fazl served as the Taliban's deputy defence minister and is accused of possible war crimes, including the murder of thousands of Shia Muslims.
Khairkhwa served as interior minister and governor of Herat, Afghanistan's third largest city. He is alleged to have had direct links to Osama bin Laden.
Some argued at the time that there was a US precedent for this type of transfer, with Ronald Reagan's administration in 1985-86 reportedly winning the freedom of US hostages in Beirut in exchange for arms destined for Iran.
Was there a political row over his release?
Some US lawmakers complained at the time that the swap breached a law that Congress should be given 30 days' notification before Guantanamo Bay detainees are released. The White House said it took the chance to free Sgt Bergdahl in "unique and exigent circumstances".
The US has a long-standing policy not to negotiate with those it deems terrorists and the prisoner swap has drawn criticism - especially from conservatives.
Republican Senator John McCain told the BBC in 2015 that the swaps "threatened" US security, as the detainees released were too dangerous to be walking free, and would put other US military lives at risk. Other lawmakers called for an inquiry into the administration and military's decision making process.
But President Obama remained publicly unapologetic for the swap.
Did the releases help the wider peace process?
No. There has been no diminution of the level of violence in Afghanistan, with President Trump recently deploying 3,000 more troops there.