WASHINGTON — An American soldier who spent nearly five years in Taliban captivity was freed Saturday in exchange for five members of the Taliban whod been imprisoned for years at the U.S. detention center at Guantanamo Bay in an unprecedented prisoner exchange that sparked both jubilation and controversy.Army Sgt. Bowe Bergdahl, 28, the only U.S. soldier taken captive by the enemy in 12 years of Afghanistan conflict, was turned over to a U.S. military task force in eastern Afghanistan at about 10:30 a.m. Eastern Daylight Time, U.S. officials said. Less than four hours later, the five Taliban detainees took off from Guantanamo headed for the Persian Gulf state of Qatar, which had brokered the deal. Under the terms of their transfer, the five are to remain in Qatar for at least a year.President Barack Obama, flanked by Bergdahls parents, made brief televised remarks Saturday evening thanking the foreign governments, American diplomats and U.S. military personnel who were behind the release effort. Sergeant Bergdahl has missed birthdays, and holidays and simple moments with family and friends which all of us take for granted, Obama said. But while Bowe was gone, he was never forgotten.Bergdahls parents, Jani and Bob Bergdahl, echoed the president in short, emotional remarks of their own in which they suggested that their son faced a long recovery after his years under Taliban control. Bob Bergdahl said his son was having trouble speaking English. Then, he addressed him directly in Pashto, one of the languages spoken in Afghanistan. I am your father, he said, translating his remarks.The deal resolves the question of whether the U.S. military would withdraw from Afghanistan without Bergdahl, who went missing from his base on June 30, 2009. But it also immediately sparked controversy. For one, the Obama administration failed to notify Congress 30 days in advance, as U.S. law requires, that it was transferring the five Taliban detainees from Guantanamo. U.S. officials explained their decision to notify Congress only after the detainees were being turned over to Qatari diplomats by saying Obama was acting in his capacity as commander in chief. This is a case of the commander in chief exercising his prerogative to get one of his soldiers back, one official said. He asked not to be identified because he was not authorized to address the issue publicly.But some members of Congress were unimpressed. Our joy at Sergeant Berghdals release is tempered by the fact that President Obama chose to ignore the law, not to mention sound policy, to achieve it, said a joint statement by Rep. Howard P. Buck McKeon, R-Calif., chairman of the House Armed Services Committee, and Sen. James Inhofe, R-Okla., the ranking member of the Senate Armed Services Committee.There were also questions about the wisdom _ and precedent _ of freeing five high-ranking Taliban, all of whom were on the Obama administrations list of detainees to be held indefinitely without charges, in exchange for one American service member. These particular individuals are hardened terrorists who have the blood of Americans and countless Afghans on their hands, said Sen. John McCain, R-Ariz., who himself was a POW in Vietnam. I am eager to learn what precise steps are being taken to ensure that these vicious and violent Taliban extremists never return to the fight against the United States and our partners.And there were nagging questions about the circumstances of Bergdahls captivity. How Bergdahl came to leave his base in Afghanistan has never been clear, and some have suggested he should be treated as a deserter, not a captive.Our focus right now is on providing him the best possible care, period, said another Defense Department official. There will be time later to look into the circumstances of his disappearance.Bergdahls hometown of Hailey, Idaho, where nearly every tree bears a yellow ribbon in his honor, erupted in jubilation as news of his release spread. A truck with a loudspeaker circled the city announcing that Bergdahl was free, eliciting cheers from residents whod watched for years as his parents lobbied to make winning their sons freedom a priority for the Obama administration.The five transferred Taliban were identified as Mohammad Fazl, Mullah Norullah Noori, Mohammed Nabi, Khairullah Khairkhwa and Abdul Haq Wasiq. The possibility of their exchange for Bergdahl had long been rumored, but U.S. officials said it was only a week ago that the deal resulting in Saturdays exchange seemed likely. During his televised remarks, Obama said he had thanked the emir of Qatar for his assistance in working on Bergdahls release earlier this week.Four of the five Guantanamo detainees were senior Taliban officials when that movement governed Afghanistan. Fazl was the Talibans deputy defense minister when he was captured by U.S. forces. Norullah Noori was the Talibans governor of Balkh Province. Khairkhwa was the Taliban governor of Herat. Wasiq was the Talibans deputy minister of intelligence. Fazl, Noori and Wasiq were among the first to arrive for detention at Guantanamo on Jan. 11, 2002. Khairkhwa was transferred there months later on May 1, 2002. Nabi, who is also known as Mohammed Nabi Omari, arrived at Guantanamo in October of 2002. He has denied being a senior member of the Taliban. According to a secret U.S. assessment, he told American interrogators that he had left the Taliban in early 2002 and had become an informant for a CIA operative he knew only as Mark. According to the assessment, which was part of a trove of documents released by the WikiLeaks website, Nabi Omari said he was arrested Sept. 14, 2002, by American troops when he arrived for a meeting with Mark.The transfer of the Taliban detainees came nearly one year after peace talks between the Taliban and the United States collapsed in Doha, Qatars capital, after the Afghan government of President Hamid Karzai refused to send a delegation to the talks. The government said it had been misled by the United States over the nature of the official office Qatar had allowed the Taliban to establish in Doha.A Pentagon official gave this account of Bergdahls release: A few dozen U.S. special forces received him, supported by multiple helicopters and overhead Intelligence Reconnaissance platforms. There were approximately 18 Taliban on site as well. We have no reports of shots being fired, and Sergeant Bergdahl was returned (to U.S. custody) once contact was made.At Guantanamo, 8,000 miles away, the five Taliban detainees were turned over to Qatari diplomats about 90 minutes later. They were put aboard a U.S. C-17 cargo plane, accompanied by the diplomats, which took off the Caribbean naval base shortly before 2 p.m. EDT.Bergdahl was able to walk and speak, the defense official said. After receiving medical treatment at Bagram Airfield in Afghanistan, he was to be flown to Landstuhl Regional Medical Center, a U.S. military hospital in Germany, for further medical care, and then was to travel to the San Antonio Military Medical Center, the official said.Depending on the wishes of his family, were working to connect him with his family via telephone or video conference soon, and at this point we expect theyll be reunited in Texas, the defense official said.The events leading up to Bergdahls disappearance from his Afghan base have never been clear. Some military officials have suggested that he left the base voluntarily and may have deserted. Published accounts, especially a Rolling Stone report on Bergdahls emails home, suggest that the soldier willingly walked away from his unit soon after arriving in Afghanistan.Rolling Stone cited emails in which Bergdahl told his parents he was ashamed to even be American and had lost faith in the mission. He also hinted at desertion, according to the report, and mailed home boxes of personal belongings such as uniforms and books. Bergdahl reportedly wrote that the future is too good to waste on lies. An Associated Press examination of the case quoted radio intercepts, released by Wikileaks, as indicating that he was later captured while sitting on a makeshift latrine. While joy over Bergdahls release permeated military forums on social media, there was also an undercurrent of uncertainty _ and, at times, outright disdain _ over the cloudy circumstances of his capture. Its called desertion, you dont celebrate it, went one tweet typical of the more skeptical camp. Another said Bergdahl should stand trial for desertion, insubordination, and treason men were killed searching for him. The Rhino Den, a blog dedicated to military issues, took on the desertion controversy in an editorial that was published in February. The commentary concluded that Bergdahl is a deserter, and at worst an outright traitor, but added that such circumstances shouldnt prevent the United States from doing it all it could do find the soldier and repatriate him. Our Warrior Ethos does not carry the caveat, unless we dont like the guy, the post stated, adding that Bergdahl eventually should face hearings to clear up how and why he left his unit.The prisoner swap is likely to be a boost to U.S.-Qatar relations, which have been tested recently by disagreements over the political crisis in Egypt and the civil war in Syria. The Obama administration has complained about Dohas support for militant groups across the Middle East, but never too strenuously, according to analysts, because of Qatars strategic importance. The Gulf state is home to CENTCOM, which oversees U.S. military operations for the Middle East and parts of Southeast Asia. In a statement Saturday, Secretary of State John Kerry thanked the government of Qatar _ and its monarch, Sheikh Tamim bin Hamad al Thani, by name _ for playing such an instrumental role in Bergdahls release. We work every day with Qatar on a range of critical foreign policy priorities, Kerry said. This effort one that was personally so close to our hearts here exemplifies how vital our partnership with Qatar is and will remain. Carol Rosenberg of The Miami Herald and Mark Seibel of the McClatchy Washington Bureau contributed to this story from Washington. Nate Poppino and John Sowell of the Idaho Statesman, contributed from Boise, Idaho..UPDATE: An earlier version of this story incorrectly identified the language Bob Bergdahl spoke at the White House.