KABUL, AFGHANISTAN — As a thin, tense-looking Sgt. Bowe Bergdahl was handed over to U.S. forces, one of his Taliban captors leaned in and warned him: “Don’t come back to Afghanistan. You won’t make it out alive next time.”

Then, the American soldier, wearing traditional loose-fitting Afghan trousers and a long tunic, was led away to a U.S. military helicopter, where he was patted down for explosives or other weapons before climbing aboard.

The weekend handover in the dusty desert was documented in a 17-minute video emailed to news organizations Wednesday by the Taliban, which touted the exchange of Bergdahl for five Guantanamo detainees as a victory, while debate raged in the U.S. over the deal and whether the 28-year-old from Hailey, Idaho, should be punished as a deserter.

Bergdahl’s hometown on Wednesday canceled plans for a welcome-home celebration later this month, citing concerns over its ability to handle the large crowds — both for and against the soldier — that were expected. The town of 8,000 has been swamped with critical emails and phone calls over Bergdahl.

Some Americans have questioned whether he deserves a hero’s welcome, since he was captured after walking away from his unit, unarmed, in 2009. U.S. lawmakers and others have also complained that Congress should have been consulted about the prisoner exchange, that the deal will embolden the Taliban to snatch more American soldiers, and that the released Afghans will filter back to the battlefield.

In Washington, Rob Williams, the U.S. national intelligence officer for South Asia, told the Senate intelligence committee Tuesday that four of the men are expected to resume activities with the Taliban, according to two senior congressional officials who spoke on condition of anonymity because the session was classified.

Under the terms of the exchange, the five Taliban detainees will have to stay for a year in Qatar. There, they will be free to communicate with their comrades in Afghanistan by courier, one of the congressional officials said.

The five include the former Taliban interior minister, who was described in a U.S. case file leaked by WikiLeaks as having had close ties to Osama bin Laden; the Taliban’s former deputy chief of intelligence; and a former member of a joint Taliban-al-Qaida cell.

The video of Bergdahl after five years in captivity shows a well-choreographed release, with the American sitting in a silver pickup truck while more than a dozen Taliban fighters with machine guns and faces largely covered by scarves stand guard nearby and on a rocky hill overlooking the site.

Bergdahl, his head shaved, blinks frequently and looks tense as he peers out of the truck. At one point, he wipes his eye as if to get rid of some dust.

A Black Hawk helicopter lands, kicking up a cloud of dust. Two Taliban fighters, one carrying a white flag of truce tied to a long, crooked stick, lead Bergdahl, now wearing a gray shawl and carrying a plastic bag, halfway toward the chopper.

Three apparent members of U.S. special operations forces approach the group, shake hands with the two Taliban fighters and take Bergdahl toward the helicopter.

One of the three men pats down Bergdahl, while another takes the plastic bag from him and drops it on the ground. Then they all climb into the helicopter.

According to a voiceover on the video, the handover took place around 4 p.m. Saturday in rugged Khost province, near the Pakistani border.

As the helicopter approaches, one of the Taliban men is heard warning Bergdahl not to come back. “You won’t make it out alive next time,” the man says in Pashto as some of the other fighters are heard laughing.

As if to underscore the point, similar words appear on the video in broken English: “Don come back to afghanistan.”

Back in the U.S., Sue Martin, a friend of the Bergdahl family and owner of Zaney’s Coffee Shop in Hailey, said Bergdahl’s appearance in the video shocked her. She said he looked frail, tired and damaged.

“That’s not the Bowe who left here and lived here,” Martin said.

Bergdahl was reported to be in stable condition at a military hospital in Germany.

A Taliban statement, also distributed to the media, quoted leader Mullah Mohammad Omar as saying the release of the five Taliban was a significant achievement for the movement.

President Obama has defended the swap, citing a “sacred” obligation to not leave men and women in uniform behind.

On Capitol Hill, Obama’s goal of closing the Guantanamo Bay prison in Cuba faced re-energized opposition from Republicans and increased questioning from fellow Democrats in reaction to the trade.

Obama appeared to be making headway last month when a Senate panel approved greater authority for him to transfer suspected terrorists to the U.S.

But the Bergdahl trade has driven a new wedge between the president and lawmakers of both parties who accuse the Obama administration of breaking the law by not giving Congress 30 days’ notice.

Hoping to ease mounting criticism, officials from the State Department, Pentagon and intelligence agencies planned a private briefing with senators Wednesday evening.

Some of Bergdahl’s former comrades have complained that U.S. soldiers died during the search for him after he walked away from his base. The military has not confirmed such a link.

U.S. Defense Secretary Chuck Hagel said Wednesday that the Army will review the case, and he cautioned against drawing conclusions until then.

“It’s not in the interests of anyone, and certainly I think a bit unfair to Sgt. Bergdahl’s family ... to presume anything. We don’t do that in the United States. We rely on facts,” he said at a NATO defense ministers meeting in Brussels.

Lee Ann Ferris, a neighbor of the Bergdahls in Hailey, said the town is trying not to pay attention to the criticism of the soldier and the talk about how he fell into Taliban hands.

“It’s like a modern-day lynching. He hasn’t even been able to give his side of the story yet. This community will welcome him back no matter what,” she said.