WASHINGTON — Two decades ago, President George W. Bush denounced the Taliban for “aiding and abetting murder” after the terrorist attacks of Sept. 11, 2001.
Now, as President Biden ends the war Mr. Bush started, the United States is locked in an uneasy partnership with that very enemy force, relying on the Taliban to help safeguard American citizens and their Afghan allies as they race to evacuate the country.
It is an improbable battlefield relationship: Diplomats, spies and military officials for the United States are having cooperative discussions with their Taliban counterparts, as the group serves as America’s first line of defense at the airport in Kabul, the Afghan capital, screening passengers for documents and weapons.
That relationship appears to have failed spectacularly on Thursday, American military officials said, when rival terrorists managed to pass through Taliban checkpoints around the airport and set off a suicide bomb that killed 13 American troops and scores of Afghan civilians.
The grim incident — and the warnings by administration officials that more attacks are possible, even likely, in the days ahead — underscores the precarious position that Mr. Biden finds himself in after overruling his military advisers in the spring and ordering a total withdrawal of American forces from Afghanistan by the end of August.
Mr. Biden has received broad criticism for his handling of the withdrawal, even from many Democrats. Republicans who eagerly supported President Donald J. Trump’s months of negotiations with the Taliban are now savaging Mr. Biden for leaning on the new rulers of the country. But once the Taliban toppled the Afghan government on Aug. 15, the imperative was set, according to Mr. Biden and his top generals. During the last 10 days, they have described a necessary, if distasteful, working arrangement.
“No one trusts them,” Mr. Biden said Thursday evening as he denounced the terrorist attack by ISIS-K, an Islamic State affiliate and a rival to the Taliban. “We’re just counting on their self-interest to continue to generate their activities. And it’s in their self-interest that we leave when we said and that we get as many people out as we can.”
Contact between the United States and the Taliban, the enemy in a war that took the lives of more than 2,400 American troops, is not unprecedented.
President Barack Obama approved talks with the Taliban in 2010 to free Sgt. Bowe Bergdahl, an American soldier who was captured by the group the year before.
During the Trump administration, the United States sought direct peace talks with the Taliban in hopes of ending the conflict. Zalmay Khalilzad, an Afghan-born former U.S. ambassador to Afghanistan, Iraq and the United Nations, was brought in to lead the negotiations, which slogged on for nearly two years in the Qatari capital, Doha.
At one point in 2019, the talks appeared so close to success that Mr. Trump sought to bring the Taliban to the presidential retreat at Camp David for a victory announcement. The trip was quickly scuttled by a suicide bombing by the Taliban in Kabul that killed 12 people, including an American soldier.
Officials working for Mr. Trump cut a deal with the Taliban leadership last year to end America’s presence in Afghanistan by May 1, a deadline Mr. Biden pushed back until Aug. 31.
U.S. officials on Friday angrily denied reports that they had handed over to the Taliban lists of vulnerable Afghans who were trying to make it to the airport. One U.S. official said Taliban fighters at checkpoints were allowed to review manifests as buses approached the group’s cordon, but not to keep the lists.
Thursday night, even as they continued to work with the Taliban after the airport attack, two U.S. officials said the C.I.A. blew up Eagle Base, a site on the outskirts of Kabul used throughout the war to train Afghan counterterrorism forces, to keep it out of the group’s hands. The operation was a raw example of how complicated the relationship is between the United States and the Taliban.
The Biden administration initially had no intention of working with the Taliban during the evacuation this month, according to American officials briefed on the plan.
When the first of the almost 6,000 troops that Mr. Biden authorized started arriving in Kabul this month, military commanders believed they would be working with the Afghan government’s security forces to help ferry Americans and others to safety. But by Aug. 15, when the Taliban swept into Kabul and President Ashraf Ghani fled the city, his security forces ceased to function.
Aug. 28, 2021, 7:25 p.m. ET
That day, Gen. Kenneth F. McKenzie Jr., a Marine who leads U.S. Central Command, met with Taliban leaders, telling them not to interfere with the evacuation. Taliban officials told General McKenzie that security was deteriorating in Kabul, and that they had to act swiftly to secure the city.
At that meeting, the Taliban offered to set up a liaison system to discuss security matters, according to a U.S. official briefed on the meeting.
During the last two weeks, there have been periodic conversations between the Taliban official in charge of security in Kabul and American military commanders, including Rear Adm. Peter G. Vasely. Those conversations reflect a pragmatic relationship of necessity, the U.S. official said. The military conversations were tactical conversations and are not expected to continue past the end of the evacuation mission on Aug. 31, the official added.
Thomas Joscelyn, who has tracked the details of the Afghanistan war at the Foundation for Defense of Democracies’ Long War Journal, said such tactical discussions were probably necessary.
Understand the Taliban Takeover in Afghanistan
Who are the Taliban? The Taliban arose in 1994 amid the turmoil that came after the withdrawal of Soviet forces from Afghanistan in 1989. They used brutal public punishments, including floggings, amputations and mass executions, to enforce their rules. Here’s more on their origin story and their record as rulers.
“There’s a certain amount of tactical talking that needs to be done here because they’re face to face, and there needs to be some tactical deconfliction,” he said.
After the bombing on Thursday, General McKenzie said the U.S. military had asked the Taliban to make adjustments to their security cordon and to close specific roads that the United States had identified as sources of threats.
“We’re doing everything we can to be prepared for those attacks. That includes reaching out to the Taliban,” he said. “And we will continue to coordinate with them as they go forward.”
American officials still believe they can rely on the Taliban to stop attacks from the Islamic State or other terrorist groups, with sharp limits that were demonstrated this week. The Taliban leadership and Islamic State are enemies who have repeatedly battled inside Afghanistan.
But even before the bombing that killed dozens, U.S. officials said the mass release of prisoners that the Taliban allowed as they took over the country was a clear sign that the Taliban would act in unreliable ways, allowing developments that could endanger the United States.
Once the evacuation is complete, much of the regular communication with the Taliban could fall to the C.I.A. The spy agency is given the task of dealing with unsavory partners and governments around the world. The C.I.A. acts covertly, so its discussions with the Taliban can be more easily shielded from public view.
The agency’s highest-profile diplomatic foray, the Monday visit to Kabul by its director, William J. Burns, could be the beginning of a series of engagements over the coming years. But how much the C.I.A. talks to and cooperates with the Taliban will probably depend on their behavior. If the Taliban allow strikes against Islamic State and Qaeda targets, and provide information about developing terrorist cells, the U.S. government is more likely to cooperate with them, officials said.
The extent of that cooperation may also depend on whether Mr. Biden finds any support for that approach on Capitol Hill.
Mr. Biden has received withering criticism from top Democrats, who have pledged to use their committee gavels to seek a full accounting of what went wrong. Republicans, meanwhile, have struggled to find a coherent criticism.
In the House, Representative Kevin McCarthy of California, the Republican leader, ridiculed Mr. Biden on Friday as “a picture of weakness and incompetence.” But that criticism came after a dizzying series of contradictory statements, including his assertions that the United States should have no troops in Afghanistan but should have held onto Bagram Air Base — which would have required more troops.
Asked whether Mr. Biden and his team are frustrated by the need to rely on the Taliban, Jen Psaki, the White House press secretary, said Friday that the administration was focused on finishing its mission.
“There’s just not a lot of time for self-reflection right now,” she said.
Catie Edmondson and Lara Jakes contributed reporting.