“TO THOSE WHO carried out this attack, as well as anyone who wishes America harm, know this,” said President Joe Biden, speaking after the suicide-bombing in Kabul killed 13 Americans and over 170 Afghans on August 26th. “We will not forgive. We will not forget. We will hunt you down and make you pay.” But with American forces on their way out, hunting down terrorists is going to get a lot harder.

Around 10,000 foreign jihadists are thought to be in Afghanistan, according to recent UN reports. Many belong to al-Qaeda, which has close ties to the country’s new Taliban rulers; a larger number are affiliated with Islamic State Khorasan Province (ISKP), a more extreme group that was behind the Kabul attack. In July Mr Biden said that America was “developing a counter-terrorism over-the-horizon capability” to spot threats and “act quickly and decisively if needed”. Such a capability would require at least two things: the ability to spot terrorists and the ability to attack them. The withdrawal from Afghanistan complicates both.

Start with the first. Much of the intelligence about groups like al-Qaeda and ISKP—such as their leadership, their safe houses and their plotting—would once have come from American troops on the ground, along with their allies in the Afghan army and the National Directorate of Security (NDS), the country’s once-formidable spy agency. Now American troops are gone and the Afghan army and NDS no longer exist. That leaves an intelligence vacuum. “It becomes increasingly difficult to see and understand what is happening on the ground, not least because the supporting infrastructure no longer exists”, says Suzanne Raine, who was director of counter-terrorism in Britain’s foreign office from 2017 to 2019.

One option is to find new Afghan allies. Strangely enough, one candidate is the Taliban. On August 26th General Kenneth McKenzie, head of the Pentagon’s Central Command, which has responsibility for Afghanistan, acknowledged that America had supplied intelligence to the Taliban on ISKP, albeit in sanitised form, and that the Taliban had thwarted some attacks. The problem is that they are unlikely to be so compliant when it comes to the groups with which they are friendlier.

“Contrary to some wishful thinking by a handful of senior [Biden] administration officials, the Taliban are not going to co-operate with us against al-Qaeda and most other terrorist groups,” says Lisa Curtis, who co-ordinated policy on South and Central Asia in the Trump White House. “While the Taliban are opposed to ISKP and will fight them, they will not do the same against the other several South Asian terror groups, like Lashkar-eTaiba and Jaish-e-Mohammad,” she says, referring to a pair of Pakistan-linked groups.

A more attractive partner may be Ahmad Masoud, a 32-year-old commander holed up in the Panjshir valley, a northern stronghold, along with Amrullah Saleh, a former NDS chief and vice-president, who has declared himself caretaker president and vowed to resist the Taliban. British and French intelligence agencies once worked closely with Mr Masoud’s father, a renowned anti-Taliban commander, and are thought to remain close to Masoud junior. Yet Panjshiri forces cover only a small sliver of the country. They would have little insight into the machinations of ISKP in the mountains of eastern Afghanistan or the suburbs of Kabul.

America is thus likely to become more reliant on electronic eavesdropping by the National Security Agency (NSA), its signals-intelligence agency. “The difference between now versus 20 years ago is that every Afghan has a cell phone,” says Sameer Lalwani of the Stimson Centre, a think-tank in Washington. Mr Lalwani points to America’s assassination of Qassem Suleimani, a top Iranian general, last year, as an example of how effective such electronic espionage can be against even the hardest targets. It can also be augmented by more traditional spying beyond Afghanistan’s borders. According to Yahoo News, a website, the CIA compromised one of Suleimani’s phones by targeting a courier who visited the Persian Gulf to procure devices. Spies may search for potential recruits among the large and growing Afghan diaspora, some of whom could slip back into the country.

Counter-terrorism is not just about collecting intelligence, but also about acting on it. Some of that action is non-lethal, such as blocking terrorist financing, taking down jihadist propaganda or sowing discord among plotters. Often, though, it involves violence. On August 27th, Jen Psaki, the White House press secretary, said that American military officials are working on “plans to develop ISIS-K targets”–perhaps to strike from a distance. That does not always go well. In August 1998 President Bill Clinton launched dozens of cruise missiles at an al-Qaeda camp in Afghanistan. He missed Osama bin Laden and killed several Pakistani villagers when a missile went astray.

Missiles are more accurate these days, but Afghanistan’s landlocked geography is unchanged. America’s raid into Pakistan against bin Laden in 2011 relied on helicopters flown from Bagram air base, near Kabul, via Jalalabad, a city in eastern Afghanistan close to the Pakistani border. Those bases are no longer available. Iran, to Afghanistan’s west, is unlikely to provide them, given its antipathy to America. America’s relations with Pakistan, which until 2011 hosted CIA drones at the conveniently located Shamsi air field in Balochistan province, are increasingly rancorous. “There is no way we are going to allow any bases, any sort of action from Pakistani territory into Afghanistan,” said Imran Khan, Pakistan’s prime minister, in June. “Absolutely not.”

That leaves Central Asia. “Uzbekistan would seem the most obvious candidate,” suggests Raffaello Pantucci of the S. Rajaratnam School of International Studies in Singapore. The country previously hosted an American base at Karshi-Khanabad, but it was shut down in 2005 after America criticised Uzbek human-rights abuses. Shavkat Mirziyoyev, Uzbekistan’s president, is keen on improving ties with America and bringing investment, says Ms Curtis. But there may be others who are less keen on the idea of American spooks and soldiers in Central Asia. “The region is under Russian thrall and Putin has signalled loudly: no US bases,” adds Mr Pantucci. “So it really depends on who would have the balls to go against him”.

More likely is that America would have to send warplanes from al-Udeid, its sprawling base in Qatar, or an aircraft-carrier in the Arabian Sea. That would have several disadvantages. Planes would take longer to arrive at their targets, during which time jihadists could move or civilians get in the way, and the fuel demands of a long voyage would mean they could spend less time over their targets. On top of that, such flights could not avoid the diplomatic headache of overflying Iran or Pakistan.

In the end, things are going to get trickier for American spies. “The US government’s ability to collect and act on threats will diminish,” acknowledged Bill Burns, the director of the CIA, in April. “That is simply a fact.” Between 2010 and 2020, American drone strikes in Afghanistan, Pakistan, Somalia and Yemen killed somewhere between 9,000 and 17,000 people, including as many as 2,200 civilians, according to figures collected by the Bureau of Investigative Journalism, a news organisation. Raids by special forces killed many more. Between 2015 and 2018 America and its Afghan allies killed more than 11,000 ISKP members.

Many of the jihadists caught up in this industrial-scale counter-terrorism campaign were not exactly burgeoning bin Ladens. America will inevitably become more selective about whom it targets, largely ignoring those that strike within Afghanistan or the region. Groups like the Islamic Movement of Uzbekistan and the East Turkestan Islamic Movement are more of a problem for local powers than America, says Mr Lalwani. But al-Qaeda, ISKP and Lashkar-e-Taiba, the outfit that killed 169 people in Mumbai in 2008, will remain potential threats.

For the past two decades, intense American pressure forced al-Qaeda’s leaders underground, hindering their communications and complicating plots. As it abates, the group may reconstitute its ability to strike Western targets. “What’s happening in Afghanistan is just the next phase in the cycle,” says Ms Raine. “It might be another five years before anything happens. But they’ve now got the space that they didn’t have, and we should expect them gradually to move back in. The question is whether we will know when it happens.”