Taliban fighters released the sole remaining American military hostage Saturday morning to a team of U.S. troops in eastern Afghanistan, who quickly hustled him onto a helicopter. Once airborne, Sgt. Bowe Bergdahl scribbled the letters “SF?” on a paper plate, seeking confirmation that he was with Special Operations forces.

“Yes!” one of the troops hollered back above the din of the aircraft’s blades, according to a defense official who described Bergdahl’s first moments of freedom. “We’ve been looking for you for a long time.”

Bergdahl, 28, who had been held captive nearly five years, broke down in tears.

His release was secured after the Obama administration, working through Qatari government intermediaries, agreed to free five high-profile Afghan inmates held by the U.S. military in Guantanamo Bay, Cuba. The influential commanders, including the former head of the Taliban’s army, were loaded onto a U.S. military aircraft bound for Qatar after U.S. officials got confirmation that Bergdahl had been freed.

Bergdahl’s “safety and health were both in jeopardy,” and officials had to act quickly to obtain his release, Defense Secretary Chuck Hagel said Sunday, according to the Associated Press.

1 of 33 Full Screen Autoplay Close Skip Ad × Taliban-held U.S. soldier released in exchange for Afghan detainees View Photos U.S. Army Sgt. Bowe Bergdahl, the only U.S. service member known to be held hostage in Afghanistan, was handed over Saturday morning by members of the Taliban in exchange for five Afghan detainees held at the military prison in Guantanamo Bay, Cuba, U.S. officials said. Caption U.S. Army Sgt. Bowe Bergdahl was handed over May 31 by members of the Taliban. U.S. Army Sgt. Bowe Bergdahl is seen in this undated photo. Courtesy of Kim Harrison Buy Photo Wait 1 second to continue.

President Obama hailed Bergdahl’s recovery as a triumph of years of high-wire diplomatic efforts that reached a breakthrough in the waning months of the U.S. combat mission there.

“He wasn’t forgotten by his country,” Obama said Saturday evening in the Rose Garden, standing alongside Bergdahl’s parents, Robert and Jani. “The United States of America does not ever leave our men and women in uniform behind.”

His father, who grew a long beard in a gesture of solidarity with his son, said a few words to him in Pashto, the language spoken in southern Afghanistan, saying that he understood his son is having trouble speaking English.

“I am your father, Bowe,” Robert Bergdahl said. “I look forward to continuing the recovery of our son which will be a considerable task for our family.”

While leaders across the political spectrum expressed relief at the news, prominent Republican lawmakers chided the White House for skirting a legal requirement to notify them about the planned release of Guantanamo inmates. Some criticized the president for breaking with longtime U.S. policy against negotiating with militant groups.

“This fundamental shift in U.S. policy signals to terrorists around the world a greater incentive to take US hostages,” Rep. Mike Rogers (R-Mich.), the chairman of the House Intelligence Committee, said in a statement.

The AP reported Hagel, who was traveling to Afghanistan to meet with U.S. troops, as saying that the action was not relayed to Congress because of its urgency. He said intelligence indicated that Bergdahl’s “health was deteriorating.”

Peaceful exchange

Bergdahl’s release at 10:30 a.m. in Khost province, which borders Pakistan, capped a week of intense, secret negotiations conducted through the Qataris. A team of dozens of Special Operations forces took custody of Bergdahl from a group of 18 Taliban fighters. The rare encounter on the battlefield between warriors who have spent years killing one another lasted just a few minutes and was peaceful, U.S. officials said.

Bergdahl walked onto the aircraft, U.S. officials said, suggesting he is in relatively stable health. Officials said it was too early to know anything definitive about the mental state of a soldier who bewildered his comrades after he walked off base in volatile Paktika province on June 30, 2009.

Officials at the Pentagon, who had grown concerned that the end of the U.S. combat mission in Afghanistan at the end of the year would dim the prospect of getting Bergdahl back alive, rejoiced.

“It is our ethos that we never leave a fallen comrade,” Gen. Martin E. Dempsey, the chairman of the Joint Chiefs of Staff, said in a statement. “Today we have back in our ranks the only remaining captured soldier from our conflicts in Iraq and Afghanistan. Welcome home Sgt. Bowe Bergdahl.”

There was no indication that the soldier would face any reprimand for the circumstances under which he was taken, which led some of his comrades to call him a deserter. While it is unclear whether he will remain on active duty, a senior U.S. military official said the Army plans to promote Bergdahl to staff sergeant next month.

“I can’t imagine there would be repercussions,” said the official, who was among several who would speak about the case only on the condition of anonymity.

Defense officials said they were working to get Bergdahl to the United States as soon as possible. After passing through Bagram air base in Afghanistan, Bergdahl was en route to the U.S military hospital in Landstuhl, Germany, according to Pentagon officials traveling with Hagel.

They said his first U.S. stop would likely be the Brooke Army Medical Center in San Antonio, where after a thorough medical screening he will likely be debriefed by intelligence officials.

Year-long stay in Qatar

The released inmates include Mullah Mohammad Fazl, a former Taliban deputy defense minister. U.S. officials said that under a memorandum of understanding signed by Washington and Doha, the men will be subject to a year-long travel ban in Qatar. They declined to offer more details about any restrictions the men would face but expressed confidence that their release would not put Americans in harm’s way.

“The United States has coordinated closely with Qatar to ensure that security measures are in place and the national security of the United States will not be compromised,” Hagel said in a statement from Singapore, where he was attending a security conference. “Sgt. Bergdahl’s return is a powerful reminder of the enduring, sacred commitment our nation makes to all those who serve in uniform.”

Hagel informed members of Congress on Saturday about the prisoner swap deal. The administration is required by law to notify Congress about its intention to release Guantanamo detainees 30 days in advance.

“Due to a near-term opportunity to save Sergeant Bergdahl’s life, we moved as quickly as possible,” a senior administration official said, speaking on the condition of anonymity to explain the timing of the congressional notification. “The administration determined that given these unique and exigent circumstances, such a transfer should go forward notwithstanding the notice requirement” in the law.

Talks falter, then revive

The Obama administration began seriously exploring the possibility of negotiating Bergdahl’s release in late 2011, when secret talks between U.S. diplomats and members of the Taliban appeared to be gaining traction. The talks, part of a broader effort to explore a negotiated end of a conflict that had only become deadlier as the White House approved a surge of 30,000 troops in 2009, collapsed in March 2012 when the Taliban suspended them, arguing that the United States was not acting in good faith.

Last summer, when the Taliban was allowed to open a political office in the Qatari capital, American officials grew hopeful that prisoner swap negotiations could resume. The effort foundered just hours after the office formally opened after the Afghan government protested that the Taliban had been given de-facto diplomatic status.

Unexpectedly, representatives of the Taliban conveyed to U.S. officials last fall that they were once again amenable to discussing the release of Bergdahl, but set as a condition that they would only deal with Washington through intermediaries, American officials said.

U.S. officials received a video of Bergdahl last fall after they had demanded proof that he remained alive. Unlike past videos of the captive, the one released last year was delivered privately, rather than through the Taliban’s media operatives. It showed the soldier looking “very gaunt, haggard,” a U.S. military official who has seen clips said.

In a departure of its former negotiating stance, the administration sought to enhance the American offer of a prisoner exchange by proposing to release the five men simultaneously. Taliban representatives had objected to the previous proposed plan, under which the inmates would be turned over in stages in an effort to test whether the Taliban and the Qatari intermediaries could guarantee that the men would not return to militancy.

A statement issued Saturday by the Taliban said the men would be residing with their families in Qatar, a tiny, wealthy Gulf emirate.

U.S. officials said they had no indication that the Taliban was open to more substantive talks but expressed hope that the swap would build trust.

“We continue to hope there will be a decision by the Taliban to move forward to initiate a political dialogue with the Afghan government, and it is our hope that the events leading to Sergeant Bergdahl’s return could potentially open the door for broader discussions with the Taliban by building confidence that the two sides can negotiate honestly with each other,” a senior administration official said.

A celebration in Idaho

The Obama administration has sought to keep Bergdahl’s profile relatively low over the years, fearing that widespread publicity of his plight would boost his value in the eyes of the Taliban and strengthen the group’s negotiating hand. For a period, White House officials asked that several U.S. newspapers refrain from publishing his name in the context of peace talks.

As his hopes dimmed, Bergdahl’s father sought to personally secure his son’s release by learning Pashto and attempting to contact the Taliban online.

Bergdahl’s parents had traveled to Washington for a Memorial Day event and stayed in town for a few days to attend meetings with senior U.S. officials. They were in Washington when Obama called them Saturday morning to deliver the news, U.S. officials said.

“We were so joyful and relieved when President Obama called us today to give us the news that Bowe is finally coming home!” Bergdahl’s parents said in a statement. “We cannot wait to wrap our arms around our only son. Today, we are ecstatic!”

In Bergdahl’s home town of Hailey, Idaho, there was jubilation Saturday. Residents had been planning a June 28 concert to call attention to his plight. They were expecting up to 7,000 people to attend, and singer Carole King was going to perform for free.

The concert will go on, said organizer Stefanie O’Neill, but it is now going to be “the biggest welcome-home party the country has ever seen.”

Kim Harrison, who said she was listed as Bergdahl’s godmother in his military records, said, “I’m excited, I’m kind of numb, and I hope that they take it easy on him when he gets back.”

She said she knows Bergdahl as the precocious teenager who took ballet with her daughter and came to spend hours at the Harrison house in Ketchum, Idaho, reading poetry and studying philosophy. She described Bergdahl as a sensitive young man who “questioned everything” and who went to Afghanistan because he wanted to help people.

“Now the only thing I can think of worth talking about is protecting him from people criticizing him and trying to find a negative source of why he left in the first place,” she said.

Karen DeYoung, traveling in Asia with Defense Secretary Chuck Hagel, and Anne Gearan, Julie Tate and Stephanie McCrummen in Washington contributed to this report.