The al-Hol camp in northern Syria—where some 70,000 women and children are languishing—is reportedly a hotbed of ISIS recruitment.Bulent Kilic / AFP / Getty

This is the story of how the Islamic State could make its comeback.

For weeks now, Iraq has been rocked by anti-government protests and violent crackdowns. Its prime minister, a U.S. ally, may resign. And now America’s local partners in Syria, the Kurds—who have done more than anyone to roll back ISIS there at the expense of thousands of lives—have been left on their own to face a potential invasion by their powerful, NATO-allied arch-nemesis, Turkey.

In a sequence of events we have seen before, President Donald Trump abruptly announced a major decision on Syria after a phone call with Turkish President Recep Tayyip Erdoğan. This time, he said U.S. troops would withdraw from positions in northeastern Syria, exposing their partners in the Kurdish-led Syrian Democratic Forces (SDF) by allowing Erdoğan to launch a long-wished-for invasion into their territory. (Erdoğan aims to remove the Kurds from their strongholds near the Turkish border because he regards them as terrorists.) Trump’s move sparked a bipartisan backlash in Congress today, prompting him to vow on Twitter that he would use his “great and unmatched wisdom” to ensure that Turkey didn’t do anything “off limits.” But the SDF was still bracing for a potential invasion and already warning that the sudden Turkish threat would undermine its counter-ISIS operations. It’s a recipe for chaos—and ISIS, which has always taken a long-term view of its struggle with America and its allies, couldn’t have written the script for its second act any better itself.

For much of America’s war against the so-called ISIS caliphate, it was clear that the extremist proto-state that ISIS created across Syria and Iraq didn’t stand much chance of lasting. The militants had no way to counter the relentless U.S. air-strike campaign and faced a committed enemy in the U.S.-backed local soldiers who did the bulk of the ground fighting. ISIS, a successor to the al-Qaeda militants who battled U.S. troops during the Iraq War, would one day return to its insurgent roots and go underground. It would ultimately be left to America’s local partners to keep up the pressure and ensure the group’s lasting defeat.

These local soldiers—the Kurds in Syria, the Iraqi military, and various other forces—have already suffered many thousands of casualties. Once the territorial caliphate was defeated, America could have focused on rebuilding them as well as the heavily bombed areas where they are now charged with keeping the peace. As The New York Times reported this summer, ISIS still has as many as 18,000 fighters across Iraq and Syria, many of them organized into sleeper cells and hit teams who carry out ambushes, kidnappings, and assassinations across both countries.

Continued U.S. support was especially important for the SDF, which number some 60,000 fighters in the northeastern corner of the country. They face a continued threat not just from ISIS but from their hostile neighbor to the north in Turkey and the Syrian regime, which has vowed to one day reclaim all its lost territory. The SDF also have tens of thousands of suspected ISIS members and their families in their custody, including some 70,000 women and children at a notorious compound in the Syrian city of al-Hol that has become a hotbed of ISIS recruitment.

Instead, Trump has left the SDF to an uncertain fate in the face of a Turkish invasion, threatening to upend their very existence. At the same time, the White House announced on Sunday that Turkey will take control of all the prisoners in SDF hands—an uncertain prospect given Turkey’s checkered history when it comes to cracking down on the militants.

Foreign fighters from around the world joined ISIS via the porous Turkey-Syria border. ISIS also sent terrorists to Europe on migrant routes from Turkey; at times, human traffickers have been allowed to operate these routes relatively unmolested. (In fact, Erdoğan has repeatedly used migrant flows as leverage in negotiations with Europe, issuing his most recent threat to “open the gates” last month.) As the ISIS caliphate collapsed, many of its members escaped from Syria into Turkey in search of safety. The idea that Turkey can successfully manage these prisoners, including the foreign fighters among their ranks, is dubious given its failures to crack down sufficiently on the ISIS cells and criminal and financial networks within its own borders.

Turkey’s problems in dealing with ISIS show, in part, the extent to which it has been destabilized by Syria’s long-running civil war. It hosts 3.6 million Syrian refugees, more than any other country. At the same time, Turkey has also been plagued by internal fissures and upheaval that have wracked its security and intelligence services. Another issue is priorities: Erdoğan is more preoccupied with battling the Kurds than he is with reining in ISIS.

This is the dynamic on display as Erdoğan pushed Trump for the green light on his planned invasion. The Kurds of the SDF are closely linked to the Kurdistan Workers’ Party, or PKK, the terrorist and separatist group that has been waging an insurgency in southeastern Turkey. Because of these undeniable ties, Erdoğan has long cast the SDF as a threat, and America’s continued support for them has strained U.S.-Turkish relations. Yet while Turkey has come up short time and again in combatting ISIS, the SDF have been some of the most effective forces at fighting the militants. The SDF spearheaded the charge to take control of the Syrian city of Raqqa, ISIS’s onetime capital, and other key areas. They continue to be crucial to U.S. aims to contain ISIS, and they still host the U.S. Special Forces who are in Syria to hunt ISIS members. A Turkish invasion would threaten to upend all this.

“He’s choosing their counterterrorism priorities over ours,” Joshua Geltzer, who was senior director for counterterrorism on the National Security Council from 2015 to 2017, told me.

Adding to the potential chaos, Erdoğan has vowed to use the areas Turkey captures to resettle at least a million Syrian refugees, creating a buffer between the SDF and the Turkish border. While Erdoğan has attempted to frame this as a humanitarian effort, it would also risk driving out a population that is predominantly ethnic Kurdish and replacing it with one that is predominantly Arab. As Ryan Gingeras and Nick Danforth, two scholars who focus on Turkey, have noted, in this the people of northeastern Syria would hear echoes of Turkey’s dark history of forcing Kurds and other minorities from their homelands.

“The safe-zone theme is just dressed-up ethnic cleansing, when you get down to it,” Nicholas Heras, a specialist on Syria and ISIS at the Center for a New American Security, told me. “This isn’t about ISIS for Turkey. They’ve made that very clear. This is about border security, and this is about their domestic political concerns related to the strain of a refugee population that many Turkish border regions don’t have the means to care for anymore.”

He noted that a Turkish incursion into the Kurdish-majority city of Afrin last year has displaced at least 100,000 people, most of them Kurdish, from the region. A conflict between Turkey and the SDF, he added, could send tens of thousands of refugees streaming south into Iraqi Kurdistan, exacerbating the instability in Iraq.

Heras, who regularly briefs U.S. officials on the Syrian conflict, told me that this and other potential ramifications of Trump’s decisions appear to have been ill-thought-out, from how Turkey would manage ISIS prisoners to how the U.S. would respond if its Kurdish partners become embroiled in a conflict with Turkey.

Republicans in Congress have signaled that they will fight Trump on the decision, and Heras noted that Erdoğan may wait to make his move, at least until a planned visit to the White House next month. Trump’s surprise decision to withdraw U.S. troops from Syria in December—which sparked the resignation of former Defense Secretary James Mattis over concerns that America was abandoning these same Kurdish partners—was eventually walked back, in part, after resistance from the U.S. military and elsewhere within the government.

But as the Times article noted, the decision still caused U.S. troops to wind down their pace of operations against ISIS in Syria. And it left the SDF, whose survival depends on reaching an accommodation not just with Turkey but with the Syrian regime, cast into limbo by Trump’s vow to withdraw troops. Whatever the outcome this time around, America’s allies in the fight against ISIS have again been undermined—and they should begin to grapple with the fact that while Trump has promised to pull America from its forever wars, the local soldiers who have fought this version of it will sooner or later be forced to do it alone. Whether they can withstand an ISIS resurgence on their own—amid the same sort of chaotic conditions in Iraq and Syria that saw ISIS rise up in 2014—is another question.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.