US 'received Qatar assurances' on Afghan prisoner deal
US President Barack Obama says he received security guarantees from Qatar over five Guantanamo Bay prisoners who were transferred to secure the release of a US soldier in Afghanistan.
US Army Sergeant Bowe Bergdahl, 28, was handed to US forces after being held for nearly five years by the Taliban.
He has left Afghanistan and is en route to a US military hospital in Germany.
Five Afghan detainees were released from the US prison in Cuba and handed to Qatar, which mediated the deal.
Sgt Bergdahl, who is said to be in good condition, was the only US soldier being held by the Taliban in Afghanistan.
His parents said they were "joyful and relieved" to hear of their son's release.
Analysis: David Loyn, BBC News, Kabul
Negotiations for the US-Taliban prisoner swap began three years ago. US negotiators met Taliban leaders face to face in Qatar, but Taliban sources told me that 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.
The Afghan government blocked further progress a year ago, enraged when the Taliban opened a political office in Qatar. But using Qatar as a mediator, the US continued talks in secret. A US source said that the breakthrough came recently when hardline Taliban elements agreed to the swap. The US believes that Bergdahl was held across the frontier in Pakistan for most of his captivity.
It is unclear what impact the release will have on a wider peace process. The Afghan High Peace Council want talks with the Taliban to happen inside Afghanistan not outside, and do not want to involve the Americans.
Hours after the release, President Obama told reporters the Qatari government had given the US assurances "that it will put in place measures to protect our national security".
He also thanked the Qatari authorities for their role in acting as a go-between during indirect US-Taliban negotiations that led to the deal.
The exchanged prisoners are thought to be the most senior Afghans still held at Guantanamo. Under the deal, they will be banned from leaving Qatar for at least a year.
The Taliban said they welcomed their release with "great happiness".
"While Sgt Bergdahl was gone he was never forgotten," President Obama said, adding that the US had an "ironclad commitment" to bringing home its prisoners of war.
He was joined by Sgt Bergdahl's parents, Robert and Jani, at the White House on Saturday. They offered thanks to those who took part in securing their son's freedom.
In an emotional speech, Robert Bergdahl said his son was having trouble speaking English after his rescue.
The BBC's Beth McLeod in Washington says the soldier is being taken to a US military medical centre in Germany, where he will receive medical treatment and begin the process of reconnecting with his family through telephone calls and video conferences.
Who are the Guantanamo detainees?
Mohammad Fazl served as the Taliban's deputy defence minister during America's military campaign in 2001. Accused of possible war crimes, including the murder of thousands of Shia Muslims.
Khirullah Khairkhwa was a senior Taliban official serving as interior minister and governor of Herat, Afghanistan's third largest city. Alleged to have had direct links to Osama bin Laden.
Abdul Haq Wasiq was the Taliban's deputy minister of intelligence. Said to have been central in forming alliances with other Islamic fundamentalist groups to fight against US and coalition forces.
Mullah Norullah Noori was a senior Taliban military commander and a governor. Also accused of being involved in the mass killings of Shia Muslims.
Mohammad Nabi Omari held multiple Taliban leadership roles, including chief of security. Alleged to have been involved in attacks against US and coalition forces.
Officials said the Taliban had handed Sgt Bergdahl over on Saturday evening, local time, in eastern Afghanistan, in an exchange that involved several dozen US special forces.
A senior official told the BBC that, once aboard the US helicopter, Sgt Bergdahl wrote "SF?" - asking if they were special operations forces - on a paper plate and showed it to the pilots, who replied: "Yes, we've been looking for you for a long time."
The senior official said: "At that point, Sgt Bergdahl broke down".
The soldier, of Hailey, Idaho, was captured on 30 June 2009, about two months after arriving in eastern Afghanistan.
In January, the US military obtained a new video of Sgt Bergdahl, giving his family renewed hope of his eventual return.
Throughout his captivity, the soldier's hometown had continued to remember him with special events and yellow ribbons tied to poles and trees.
"I'm beyond thrilled," Stefanie O'Neill, a family friend in Hailey, told Reuters on Saturday. "It's probably the happiest day of my life, besides when my two kids were born."
She said a Bring Bowe Back vigil planned for 28 June would now be called Bowe is Back.