The U.S. special operations raid that killed the Islamic State militant group’s top terrorist Abu Bakr al-Baghdadi on Saturday was almost perfect. The military, the intelligence agencies, the American allies and Trump administration officials all deserve credit for this success, as well as the drone strike Monday that killed ISIS spokesman Abu Hassan al-Muhajir. But the Trump administration’s recent actions could make the al-Baghdadi raid one of the last of its kind for many years.

ISIS and other terrorist groups adapt quickly, and will start looking for safe havens that are impossible for U.S. special operations teams and drones to access.

For more than a decade, until June 2019, I represented the Department of Homeland Security in interagency discussions that led to numerous successes — and some failures — against ISIS, al Qaeda and other terrorists at home and overseas. Over those years, we learned what it takes to defeat groups such as ISIS, and our success is based on two crucial factors that President Donald Trump’s recent decisions put at risk.

First, we are running out of territory on which our military can carry out lethal ground operations. ISIS still has an underground presence in the area of northeast Syria from which Trump abruptly withdrew U.S. forces Oct. 6. Previously, U.S. aircraft used to fly freely over this region and our troops had the freedom to work alongside the Syrian Kurds to collect intelligence. But since the withdrawal, they no longer have that access.

Both Syrian regime and Russian troops have already moved in, with Iranians likely not far behind. All three are working to make it harder for the United States to fly over most Syrian territory. Even Saturday’s al-Baghdadi operation had to be rushed before the U.S. lost access to Syrian Kurdish territory and the ability to overfly northern Syria.

In Iraq, where other ISIS fighters have gone underground, Trump’s tough Iran policy and his loose talk in February 2018 that U.S. forces were in Iraq to look “a little bit at Iran” have reduced American troops’ access on the ground: The Iraqi government has tried to steer a neutral course between its American and Iranian “friends,” so these comments pushed Iraq into a corner. Iraq responded by imposing stricter limits on the numbers and missions of U.S. troops. Last week, Iraq denied an American request to relocate forces leaving Syria to Iraqi territory.

U.S. military drone strikes against terrorists will continue because, unlike raids, they don’t risk the lives of U.S. soldiers. However, it is harder to carry out drone strikes in places like Afghanistan, where troop reductions, also ordered by Trump, reduce the military’s ability to cover territory and find out what terrorists are doing. Elsewhere, the success of U.S. counterterrorism efforts in Libya, Afghanistan, Somalia and Yemen is driving terrorist groups to rethink how and where they hide. ISIS and other terrorist groups adapt quickly, and will start looking for safe havens that are impossible for U.S. special operations teams and drones to access.

Turkey is another location where terrorists know U.S. raids or drone strikes are not possible. Either would rupture already frayed U.S. ties with its NATO ally, risk U.S. access to Turkey’s Incirlik Air Base and jeopardize what’s left of U.S.-Turkish counterterrorism cooperation, which is still valuable to the U.S. This is a very serious problem because al-Baghdadi was hiding in Idlib province, a few miles from Turkish territory. While Turkey’s counterterrorism capabilities have improved in recent years, ISIS terrorists can still hide in Turkey or transit through it to join ISIS cells in Europe and elsewhere.

Second, drone strikes and ground raids rely on similar networks of allies and information collection capabilities. The Syrian Kurds provided access to a key intelligence source on al-Baghdadi, for instance, and they gave other assistance that helped the U.S. military plan raids and drone strikes against ISIS fighters over the past three years.

Trump’s surprise Syria withdrawal opened the way for a Turkish attack on our Syrian Kurdish allies. That betrayal will make it harder for the U.S. to get any foreign entity’s help the next time we need it, especially when we ask them to take risks.

Today, U.S. military counterterrorism capabilities are the best in the world and operate at a level of sophistication no other country can come close to matching. But this took decades to develop. The Obama administration, for instance, spent years building up the defense relationships, intelligence networks and special operations forces that led U.S. military commandos to Osama bin Laden in 2011 —and, this week, to al-Baghdadi. The Trump administration largely continued this plan in 2017-2018, earning kudos in its early years for removing some of the bureaucracy that slowed down operations unnecessarily.

But now, we’re at risk of losing the capabilities that led to Saturday’s success, and of failing to develop the new ones we’ll need for the future. We will still need the option to do raids, but counterterrorism officials agree that the U.S. needs to use more than just military means to prevent terrorism. I’ve been in policy meetings with dozens of special operations generals — the kind the president says he admires — warning that we will not be able to kill our way to victory indefinitely.

Instead, we need to increase nonmilitary ways to find, arrest, prosecute and incarcerate terrorists, and to prevent them from boarding planes or crossing borders. Both the Obama and Trump administrations’ counterterrorism strategies have called for helping other countries improve civilian counterterrorism capabilities in this regard.

We’re at risk of losing the capabilities that led to Saturday’s success, and of failing to develop the new ones we’ll need for the future.

Yet if this approach is going to be successful, particularly if we limit our military options, it requires greater funding than it’s received. In particular, the U.S. needs to invest more in helping our allies build up their civilian counterterrorism, aviation security, border security, terrorism prevention and law enforcement capabilities. The Atlantic Council has been trying to find ways the U.S. and key counterterrorism partners can do this more effectively. Some of our allies can pay their own way, and just need a partner to share each other’s “best practices.” Other allies will need more direct assistance. That is, if these countries are willing to continue working with us.

In the meantime, I have no doubt U.S. forces will make the most of any opportunities to disrupt ISIS given Trump’s orders for at least some American troops to stay in eastern Syrian to protect the oil fields there. But this should not be confused with the full support needed from the president to ensure ISIS’ permanent defeat — which he said at the Pentagon days after his inauguration was the reason the U.S. is fighting ISIS in the first place.