Just shy of the fifth anniversary of his abduction from a military base in Afghanistan, Sgt. Bowe Bergdahl, the only American P.O.W. still in captivity, was released by his Taliban captors and is back in American custody Saturday. The news came via a statement released Saturday by the White House, in which U.S. President Barack Obama expressed gratitude to the Emir of Qatar for his efforts in securing Bergdahl’s freedom.

“On behalf of the American people I was honored to call his parents to express our joy that they can expect his safe return,” said Obama in the statement.

A separate statement from Secretary of Defense Chuck Hagel said that he told Congress earlier in the day that the U.S. would be transferring five detainees from Guantanamo Bay to Qatar. Though the names of the detainees were not mentioned, it is most likely that their transfer is linked to Bergdahl’s release: in March of 2012, a similar exchange, negotiated between the U.S., representatives of the Taliban, the Qataris and the Afghan government, collapsed. That deal fell apart likely due to Congressional foot dragging and a schism between the Taliban faction that wanted to negotiate and the group that held him captive.

How Bergdahl, 28, fell into the hands of the Taliban remains unclear. Within days of his disappearance on June 30, 2009, a Taliban commander crowed to the media that his group had captured a drunken American soldier outside his base. Two and a half weeks later, they released a video in which Bergdahl, dressed in local garb and showing the beginnings of a wispy beard, said he had been captured after falling behind on a routine foot patrol. Unnamed soldiers from his base, however, told international media outlets that he had wandered into the scrub-covered mountains on his own with his journal and a supply of water, leaving his weapons and armor behind. An unidentified U.S. official told the Associated Press at the time that he had “just walked off” after his guard shift was over.

As the months passed his captors released videos — proof of life, perhaps, but also propaganda. In one video, dating to April 2010, Bergdahl sports a thick beard and wears an army sweatshirt that looks fresh out of the package. Bergdahl says he is being treated well and is allowed to exercise. One of his captors, a commander with the Haqqani network that was holding him, told TIME in 2012 that at that point, Bergdahl, who was raised a devout Presbyterian, started talking about converting to Islam. Suspicious at first, his captors asked if it was out of fear or frustration that he wanted to convert.

“He told us, ‘Your way of life has impressed me, and I want to live like you,’” said the commander.

Bergdahl escaped a few months later, only to be recaptured several days afterwards and severely beaten.

In November of 2011, the U.S. government initiated talks with the Taliban in Qatar in the hope of bringing an end to the war. In the course of the discussions, the Taliban told the Americans that they wanted five senior Taliban officials released from Guantanamo, according to a senior Administration official. The U.S. then raised the possibility of including Bergdahl in the process. The two sides soon had a tentative agreement.

However, the talks fell apart on March 15, 2012. Discussions of an exchange then faded into the background as the U. S. started considering other ways to bring the war in Afghanistan to a close. The White House and the Pentagon, however, insist that Bergdahl had never been forgotten, and that efforts to secure his release continued non-stop. Today’s statements from Washington indicate that after a two-year delay, they finally met success — Bergdahl is on his way home.

For Bergdahl’s family in Hailey, Idaho, it will be the end of an agonizing journey.

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

But for Bergdahl, who has been criticized by many for the circumstances surrounding his capture and his appearance in propaganda videos, it will be just the start.

“He will always be separate from everyone else–not an outcast, but isolated,” Jere Van Dyk, a CBS news consultant who was captured and held for 45 days in 2008 by the same group, told TIME in 2012. “And it won’t be right, but he will be called a traitor. He has a long road ahead.”

Contact us at letters@time.com.