Last month, President Biden vowed that his decision to pull American forces out of Afghanistan would never end in a repeat of the infamous helicopter evacuation from the U.S. Embassy in Saigon at the ignominious close of the Vietnam War. “There’s going to be no circumstance when you’re going to see people being lifted off the roof,” he said.

But the drama in Afghanistan is now closer to that scenario than Biden might have envisioned, as the president found himself ordering thousands of troops back into Kabul to help evacuate American diplomats from the bunkered U.S. Embassy.

The country edged toward collapse Friday as senior Afghan officials and hundreds of government troops surrendered to the Taliban. The militants overran three key cities and partly encircled the capital Kabul, where the U.S.-backed government appeared tenuous.

"The Afghanistan Papers" author Craig Whitlock explains how presidents misled the public about the war in Afghanistan for nearly two decades. (Joy Yi/The Washington Post)

The moment highlighted the enormous gamble Biden has taken in withdrawing troops from a conflict he says has lasted too long and cost too many lives. The Taliban’s strikingly rapid onslaught is bolstering the appearance that the United States has lost or given up in Afghanistan, a prospect from which Americans have historically recoiled.

It is also a grim reckoning for Biden, who announced in April that all U.S. forces were coming home after an inconclusive and, as he saw it, increasingly irrelevant conflict. It was a pivotal moment in his presidency, as he rebuffed Pentagon recommendations that the United States maintain a small force in the country.

And he has not backed away, even as conditions on the ground have worsened. “I do not regret my decision,” he said Tuesday, despite a new intelligence assessment that Kabul could fall to the Taliban in as little as a month.

American diplomats began destroying classified documents and equipment Friday in preparation for a potential takeover of the U.S. Embassy, per orders in an internal memo obtained by The Washington Post.

U.S. officials said the latest developments would not derail the withdrawal strategy, in which all American forces leave the country by the end of the month. But the need for reinforcements underscored that the plan has brought unforeseen consequences.

If the United States were simply handing off responsibility to the Afghan security forces, as Biden has said, there would be no need for thousands of armed U.S. troops to guarantee the safe departure of Americans and vulnerable Afghans, said Ryan Crocker, a former U.S. ambassador to Afghanistan.

“You can’t rewind this film,” Crocker said, suggesting that Americans will see a botched effort and question Biden’s abilities.

“Of course the Republicans will have a field day with it,” Crocker said. “But for a whole lot of other Americans, you have to look at what’s happening and think, ‘This is the commander in chief, this is the guy who’s responsible for the security of the nation, and what an incredible mess he’s made of it in his first time out of the blocks.’ ”

Republicans are already pouncing as Afghanistan’s collapse has accelerated in recent days. Over the past week, the Taliban has moved on the major cities of Kandahar and Herat; the Taliban has swept up more territory; and Americans have been urged to leave Afghanistan.

“This debacle was not only foreseeable, it was foreseen,” Senate Minority Leader Mitch McConnell (R-Ky.) said Friday. “The president and his team actively decided against a far more responsible approach to preserving our national security interests and protecting our Afghan partners,” McConnell said in a statement.

He urged immediate U.S. military action to prevent the Taliban from overrunning Kabul, something Biden has shown no willingness to do.

But the politics of Afghanistan — and of U.S. foreign engagements in general — are not straightforward. Some centrist Democrats have joined hawkish Republicans in questioning the pullout. And some conservative libertarians agree with liberal peace activists that the United States should not spend blood and treasure overseas that could be used at home.

Former Republican congressman Justin Amash of Michigan, for example, suggested the Taliban’s onslaught only proves the wisdom of withdrawing.

“The Taliban’s rapid gains in Afghanistan underscore the futility of permanent occupation,” Amash tweeted Thursday. “The United States wasn’t able to meaningfully shape circumstances through 20 years of war. We’d have seen the same results had we pulled out 15 years ago or 15 years from now. End the wars.”

Biden has stuck with his gut instincts all along, convinced that the United States should have left years ago and suspicious of Pentagon leaders’ arguments for staying. Announcing the withdrawal in April, Biden noted that he is the fourth U.S. president to preside over the war, which has cost billions of dollars and killed more than 2,000 American troops.

“I will not pass this responsibility on to a fifth,” he said at the time.

Biden initially supported the 2001 U.S. invasion of Afghanistan, but by 2005, he had changed his mind. As vice president, he opposed the expansion of the war under President Barack Obama.

Biden’s confidence that he can quit a war that snared his predecessors also is based on a view that leaving will have few costs for the United States. Biden argues that terrorism is not the threat it was — especially from Afghanistan — and that the United States is better served by focusing on China, which he sees as the true national security threat.

Most Americans support the military withdrawal, which was initially announced last year by President Donald Trump. In a rare instance, Biden stuck to Trump’s plan, though he extended the deadline for withdrawal by about four months.

A survey conducted by the Chicago Council on Global Affairs in July found 70 percent support among Americans for the decision to withdraw. A May Quinnipiac poll found a smaller 62 percent approving.

Even if the Taliban takes over, Biden’s supporters say, it would make little sense for the United States to linger for decades, shoring up an unstable government and losing even more lives. But the swift Taliban gains could threaten that consensus, said Lisa Curtis, who was a top foreign policy adviser to Trump.

“It depends on what happens in the coming weeks and months,” said Curtis, who is now with the Center for a New American Security. “If there is a humanitarian catastrophe, or women are getting shot in the streets by the Taliban, and this is played over U.S. networks, I think it will be a major stain on the Biden administration.”

Trump contended Thursday that if he were still in charge, the withdrawal would be going far more smoothly.

“I personally had discussions with top Taliban leaders whereby they understood what they are doing now would not have been acceptable,” Trump wrote in a fundraising appeal. “It would have been a much different and much more successful withdrawal, and the Taliban understood that better than anyone.”

The political risk to Biden will grow if he is wrong and significant terrorist attacks are launched from Afghan soil. U.S. intelligence officials acknowledge that the troop withdrawal — along with the end of CIA access to bases and the shrinking of the embassy staff — has significantly reduced the United States’ ability to watch, and strike, al-Qaeda and the Islamic State.

“When the time comes for the U.S. military to withdraw, the U.S. government’s ability to collect and act on threats will diminish. That’s simply a fact,” CIA Director William J. Burns told the Senate Intelligence Committee in the spring.

Burns told NPR in July that the CIA would “retain significant capabilities both in and around Afghanistan” to monitor terrorist activity. But he spoke before Afghanistan’s neighbors made it clear they would reject the positioning of U.S. counterterrorism resources on their territory.

For now, U.S. intelligence capabilities are largely dependent on aircraft carriers in the Arabian Sea and facilities as far away as the Persian Gulf to keep an eye on Afghanistan.

William F. Wechsler, a senior counterterrorism official in the Obama administration, said the effectiveness of such “over-the-horizon” operations depends on their distance from the target. “You can do it,” Wechsler said. “It’s just that your effectiveness goes down and the risk goes up.”

But the task becomes close to impossible, he said, when the United States has little or no intelligence presence on the ground, even to deal with local operatives, at a viable U.S. Embassy.

Although the Islamic State is not viewed as a major threat emanating from Afghanistan, al-Qaeda is gaining strength there and has significant ties to the Taliban, experts said, making it a potential force to be reckoned with.

Sens. Jeanne Shaheen (N.H.) and Robert Menendez (N.J.) are among the Democrats who question Biden’s withdrawal plans, while Sen. Chris Murphy (D-Conn.) backed the president Monday on the Senate floor.

Like Amash, Murphy argued that the Taliban’s gains prove the need for the withdrawal, not its futility.

“The Taliban’s surge is actually a reason to stick to the withdrawal plan,” he said. “The complete, utter failure of the Afghan National Army, absent our hand-holding, to defend their country is a blistering indictment of a failed 20-year strategy predicated on the belief that billions of U.S. taxpayer dollars could create an effective, democratic central government in a nation that has never had one.”

Biden said much the same Tuesday, telling reporters that Afghan forces need to muster the will to fight for their own country.

“Afghan leaders have to come together. . . . They’ve got to fight for themselves, fight for their nation,” Biden said. “I think they’re beginning to realize they’ve got to come together politically at the top, but we’re going to continue to keep our commitment. But I do not regret my decision.”

Paul Rieckhoff, founder of Iraq and Afghanistan Veterans of America, said that message ignores the role played by the United States in setting up the current faceoff. “That is geopolitical victim shaming,” Rieckhoff said.

As conditions deteriorate, he warned, American leaders will not be able to avoid their own culpability. “When the Taliban gets in there and fires up their cellphones and starts sending beheading videos, they will not be able to spin this,” Rieckhoff said.

Crocker had his own pithy summation of the risk, saying, “This may make Saigon look good.”

Scott Clement and Mike DeBonis contributed to this report.