In between rounds at his golf club, on both Saturday and Sunday, President Trump decided that he was done with Syria. He ordered the evacuation of a thousand U.S. Special Forces troops deployed to contain ISIS, the jihadi movement that still has tens of thousands of members waging an underground insurgency across Syria and Iraq. For five years, the Americans have been the backbone of support—providing air power, intelligence, and strategic advice—for the Syrian Democratic Forces. The Kurdish-led militia did the actual fighting against ISIS, losing eleven thousand fighters along the way. It evolved into one of the most important U.S. allies anywhere in the Middle East. More than seventy nations joined the coalition backing the S.D.F., but the United States has been the glue holding it together.

As if on cue, on Sunday, hundreds of families and supporters of the Islamic State escaped from a detention center in Ain Issa, in northeastern Syria. The Kurds reported that the black ISIS flag was soon erected nearby. “Five years of work—undone,” a U.S. official lamented to me, on Sunday. Trump’s order to withdraw also prevented U.S. forces from being able to transfer about sixty “high-value” ISIS prisoners from detention centers in the area controlled by the S.D.F., the Times reported.

The area where U.S. troops have been deployed has disintegrated into chaos since Turkey invaded Syria last week—and President Trump opted to do nothing to stop or discourage President Recep Tayyip Erdoğan’s campaign to destroy U.S. allies in the S.D.F. An estimated hundred and thirty thousand Syrians have fled Turkish air strikes, artillery, and ground operations, according to the United Nations. Hospitals in Kurdish areas in the north have closed. Water is running short.

Videos on social media appear to show members of a militia mobilized by Turkey, dubbed the Syrian National Army, summarily executing captives from the S.D.F. and its political arm. “It appears to be” war crimes, the Defense Secretary, Mark Esper, said on Sunday, on CBS’s “Face the Nation.” “It’s a very terrible situation over there, a situation caused by the Turks. Despite our opposition, they decided to make this incursion.”

On Saturday night, Trump grumbled that he was “an island of one” in his decision to end the U.S. mission. “We have to bring our great heroes, our great soldiers, we have to bring them home. It’s time. It’s time,” Trump said, in a speech to the Values Voter Summit, an annual gathering of a group of conservative activists. He described the Middle East broadly as a quagmire and its people as incapable of peace. “It’s less safe now. It’s less secure, less stable, and they fight,” he said. “That’s what they do. They fight.”

Esper offered a slightly different take. “We have American forces likely caught between two opposing, advancing armies, and it’s a very untenable situation,” he said on “Face the Nation.” “So I spoke with the President last night, after discussions with the rest of the national-security team, and he directed that we begin a deliberate withdrawal of forces from northern Syria.”

U.S. Special Forces came under Turkish artillery fire on Friday, the Pentagon reported. The Pentagon had earlier provided the Turkish military the so-called grid of U.S. deployments inside Syria. “We gave them the location of our forces, [but] there’s a fog out there. Things happen,” Esper said on CBS.

Turkey’s goal is to create a buffer zone along its border with Syria. It would run at least thirty kilometres into Syria, in an area dominated by Kurds. Erdoğan fears that the Kurds, who make up the largest ethnic and linguistic minority in Turkey, will unite in a separatist campaign to create their own state. The U.S. had been working with the S.D.F. to address Turkey’s concerns, but Erdoğan opted to invade anyway.

The five-year campaign by a U.S.-led coalition to confront and destroy the world’s most fanatical movement now risks unravelling. ISIS still has branches across the Middle East, which have killed thousands. One of its deadliest attacks was the bombing of a Russian airliner flying from Sharm el-Sheikh to St. Petersburg, in 2015. During the five years of the Islamic State’s caliphate, ISIS planned or inspired some of the most heinous terrorist attacks in the West, including in Manhattan, Orlando, and San Bernardino, and at Ohio State.

“We may want a war over—we may even declare it over,” the former Defense Secretary James Mattis said on NBC’s “Meet the Press.” “You can pull your troops out, as President Obama learned the hard way out of Iraq, but the ‘enemy gets the vote,’ we say in the military. And, in this case, if we don’t keep the pressure on, then ISIS will resurge. It’s absolutely a given that they will come back.” Mattis resigned in December, when Trump first announced his intention to wind down the U.S. presence in Syria and end the alliance with the S.D.F.

Trump faces a bipartisan challenge to his Syria policy. Senator Robert Menendez, a Democrat of New Jersey and the ranking member of the Senate Foreign Relations Committee, condemned the withdrawal of U.S. troops and the decision’s inevitable repercussions. “With this withdrawal, President Trump is further weakening the United States’ position on the global stage, actively weakening our national security and further undermining our credibility with partners and allies,” he said in a statement on Sunday. “This administration’s chaotic and haphazard approach to policy by tweet is endangering the lives of U.S. troops and civilians. The only beneficiaries of this action are ISIS, Iran and Russia.”

General Mazloum Kobani Abdi, the S.D.F. military commander, charged the top U.S. official in Syria with leaving the Kurds to be slaughtered, according to a U.S. memo of the exchange, which was obtained by CNN. “You have given up on us. You are leaving us to be slaughtered,” Mazloum said to William Roebuck, on Thursday. “You are not willing to protect the people, but you do not want another force to come and protect us. You have sold us. This is immoral.”

The Syrian Democratic Forces have been scrambling to find new partners to help navigate an end to Turkey’s invasion. In an ironic twist for the United States, Mazloum has had talks with Russia and the regime of President Bashar al-Assad. Russia and the Syrian government, and also Iran, have long sought control over the third of Syria that is currently under the control of the S.D.F. Many of the country’s most valuable oil assets are in that region.

On Sunday evening, the S.D.F. announced that it had reached an agreement with the Assad government to deploy Syrian-government troops along the border with Turkey, “to help the S.D.F. stop this aggression.” The government news agency reported that Syrian troops were already moving north. Russia was reportedly the key mediator between the S.D.F. and Syria during the previous three days. The partnership marks a major shift for the Kurds, who have long sought more rights or self-rule from Syria, because of the government’s long history of persecution and discrimination against the minority. Kurds make up about ten per cent of Syria’s eighteen million people.

The chaos did not seem to bother Trump as he went off to play golf. On Sunday, the President’s motorcade passed a group of protesters outside Trump National Golf Club. They carried signs, according to the White House pool, that read “TRAITOR” and “FAKE POTUS.” The Kurds who have fought alongside the U.S. might agree.