You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
Army Sergeant Bowe Bergdahl had been held for nearly five years by Afghan militants and his release followed years of on-off negotiations.
President Barack Obama announced the release, saying he had called Bergdahl's parents to let them know.
U.S. special forces took custody of Bergdahl in a non-violent exchange with 18 Taliban members in eastern Afghanistan, senior U.S. officials said, adding that he was believed to be in good condition. He was now undergoing a medical examination in Afghanistan.
Bergdahl, 28, was handed over at about 6 p.m. local time on Saturday, which was at 10:30 a.m. Washington time, a senior official said. The U.S. forces, who had flown in by helicopter, were on the ground only briefly, said the officials, who would not specify the precise location of the handover.
A U.S. defence official said Bergdahl was able to walk and became emotional on his way to freedom.
"Once the was on the helicopter, he wrote on a paper plate, 'SF?'" the official said, referring to the abbreviation for special forces.
"The operators replied loudly, 'Yes, we've been looking for you for a long time.' And at this point, Sergeant Bergdahl broke down."
Bergdahl, who is from Idaho, was the only known missing U.S. soldier in the Afghan war that was launched soon after the Sept. 11, 2001 attacks on the United States to dislodge the Taliban - accused of sheltering al Qaeda militants - from power.
He was captured under unknown circumstances in eastern Afghanistan by militants on June 30, 2009, about two months after arriving in the country.
Bergdahl's release could be a national security boost for Obama, whose foreign policy has come under widespread criticism in recent months.
But some members of Congress have in the past criticized the potential release of the five Taliban detainees, particularly Mohammed Fazl, a so-called "high-risk" detainee held at Guantanamo prison since early 2002. Fazl is alleged to be responsible for the killing of thousands of Afghanistan's minority Shiite Muslims between 1998 and 2001.
U.S. officials referred to the release of the Taliban detainees from Guantanamo as a transfer, noting they would be subject to certain restrictions in Qatar.
As of mid-day Saturday in Washington, the five had not yet left for Qatar, one senior official said.
Bergdahl's freedom followed a renewed round of indirect U.S.-Taliban talks in recent months, with Qatar acting as intermediary, the officials said. It also came just days after an other step in the winding down of the war.
Obama announced this week that he would keep 9,800 U.S. troops in Afghanistan, mostly to train Afghan forces, after NATO combat operations cease at the end of 2014. The last soldiers, aside from a small presence at U.S. diplomatic posts, will leave at the end of 2016.
"Today the American people are pleased that we will be able to welcome home Sergeant Bowe Bergdahl, held captive for nearly five years," Obama said in a statement.
"On behalf of the American people, I was honored to call his parents to express our joy that they can expect his safe return, mindful of their courage and sacrifice throughout this ordeal."
FAMILY, HOMETOWN CELEBRATE
The Bergdahl family was in Washington when news of the release broke, a senior U.S. defense official said, without giving details.
"We were so joyful and relieved when President Obama called us today to give us the news that Bowe is finally coming home!" Bob and Jami Bergdahl said in a statement released through the Idaho National Guard. "We cannot wait to wrap our arms around our only son."
It was not yet known when he would be coming back to the United States. But in his hometown, Hailey, Idaho, news of the release prompted celebration.
"Once we heard about it. We were pretty excited," said 17-year-old Real Weatherly, who was making signs Saturday morning and blowing up balloons to hang outside the shop where she works. "We want to let people know he's free. "
Defense Secretary Chuck Hagel, traveling in Asia, said in a statement that Bergdahl would be given "all the support he needs to help him recover from this ordeal, and we are grateful that he will soon be reunited with his family."
The Afghan Taliban on Saturday confirmed it had freed Bergdahl.
"This is true. After several rounds of talks for prisoners' swap, we freed US soldier and our dear guest in exchange of five commanders held in Guantanamo Bay since 2002," a senior Taliban commander said.
Declining to be identified, he said talks for the prisoners' release had been going on for the past several weeks.
The Taliban commander said Bergdahl had mostly been held in the tribal areas between Pakistan and Afghanistan after what he termed his "dramatic" kidnapping from Afghanistan's Paktika province in June 2009.
Reuters first reported the potential deal involving the five Taliban detainees in December 2011.
Bergdahl's eventual release was the result of years of complex, frustrating negotiations that a senior U.S. official, speaking on condition of anonymity, said revived last November when the Taliban signaled it wanted to resume talks on prisoners.
But it was unclear why the Taliban moved now to conclude a deal that Washington had been seeking for years.
"Several weeks ago, an opportunity arose to resume talks on Sgt. Bergdahl, and we seized it," one senior U.S. official said. "This was an opportunity that only recenly became possible."
While U.S. and Taliban envoys have met directly in the past, there were no direct U.S.-Taliban contacts during the most recent negotiations, U.S. officials said. Messages were past via Qatari officials.
The final stage of negotiations, which took place in the Qatari capital of Doha, began one week ago, the U.S. officials said. Obama and Qatar's emir spoke on Tuesday and reaffirmed the security conditions under which the Taliban members would be placed while in Qatari custody, they said.
One of the senior U.S. officials said those conditions would include a minimum one-year ban on them traveling outside of Qatar as well as monitoring of their activities.