(CNN) -- It was another day in nearly five years of captivity for U.S. Army Sgt. Bowe Bergdahl, and he didn't know what the 18 Taliban fighters had in store for him Saturday.
There, in the rugged mountains of eastern Afghanistan near the Pakistan border, the heavily armed fighters turned Bergdahl over to U.S. military commandos.
The soldier's plight had come to an end.
Within minutes he was airborne. The helicopter's rotors whooped so loudly that Bergdahl couldn't communicate clearly with the men on board.
So he grabbed a paper plate and wrote three characters: "SF?"
The men understood: Special Forces?
The U.S. commandos didn't bother to write back.
"Yes!" shouted at least one over the roar of the flight. "We've been looking for you for a long time!"
The long road to freedom began for Bergdahl with his capture on June 30, 2009, in Afghanistan's Paktika province, where he was deployed with the 25th Infantry Division.
The soldier disappeared after finishing a guard shift at a combat outpost.
It was about 4:30 a.m. when he was first reported missing, and by 7 a.m. his comrades began an all-out search to find him, according to secret military reports made public by WikiLeaks in 2010.
But there was no sign of the soldier. According to the reports, radio conversations between suspected militants picked up by U.S. reconnaissance aircraft confirmed he had been captured.
Conflicting details have since emerged about how the militants managed to capture Bergdahl. Published accounts have varied widely, from claims he walked off the post to another that he was grabbed from a latrine.
U.S. officials believe he was captured by the Taliban, but may have been held by the Haqqani Network, a terror group that operates along the Afghanistan-Pakistan border. The group is aligned with the Taliban and al Qaeda.
In the ensuing years, there were occasional video clips released by his captors. The so-called proof-of-life videos appeared to show the soldier gaunt and disheveled. Over time, he appeared with a beard
The U.S. government acknowledged in May 2012 that it had been engaged in direct talks with the Taliban to free Bergdahl. The Taliban, according to officials, broke off those talks.
For more than year, there was no word of the soldier.
Road to freedom
Then, in November 2013, the Taliban signaled it was prepared to talk, according to senior administration officials.
In return, the United States asked for proof of life, they said.
That proof came in December in the form of a video of Bergdahl, the first in three years. And it showed the effects years of captivity had on the soldier, who appeared haggard and unwell.
With neither U.S. officials or the Taliban trusting each other, Qatari officials took on the role of intermediary.
The negotiations began in earnest last week, with Qatar ferrying messages back and forth between U.S. officials and the Taliban.
It culminated in Doha, with the agreement that called for the handover of Bergdahl in exchange for five detainees held at Guantanamo Bay Naval Base, the administration officials said.
As Taliban fighters headed with Bergdahl toward an agreed upon meeting point in Afghanistan, on the other side of the world Qataris officials were waiting for the five detainees to be released.
According to senior administration officials, the Qatari officials met the detainees on a runway at the Guantanamo Bay Naval Base.
How the Qataris signaled to the Taliban that the detainees were in the custody is unclear, and administration officials have not detailed the communications.
Flight to freedom
It was late afternoon Saturday in Afghanistan, about 10:30 a.m. ET, when Bergdahl surrounded by 18 Taliban fighters was led to a meeting point.
There, waiting, were U.S. commandos, according to the officials. In the air above, helicopter gunships circled.
Slowly, Bergdahl walked toward the commandos.
It is believed the soldier was searched by the commandos, who as a matter of protocol would check to make sure the Taliban had not strapped explosives on him.
Within a matter of minutes, Bergdahl was aboard a helicopter bound for Bagram Air Base.
On the helicopter, with the knowledge he was in the hands of Special Forces, Bergdahl broke down and cried.
He was free.
CNN's Michael Martinez contributed to this report.
™ & © 2014 Cable News Network, Inc., a Time Warner Company. All rights reserved.