ANKARA, Turkey (AP) — President Donald Trump framed the U.S.-brokered cease-fire deal with Turkey as “a great day for civilization,” but its effect was largely to mitigate a foreign policy crisis widely seen to be of his own making.

After hours of negotiation in Ankara, the two nations on Thursday agreed to a five-day cease-fire in the Turks’ deadly attacks on Kurdish fighters in northern Syria, but some fighting continued early Friday in a northeast Syrian border town. The Kurds were U.S. allies in the fight against the Islamic State group but came under assault after Trump ordered U.S. troops to leave the area earlier this month.

The agreement requires the Kurds to vacate a swath of territory in Syria along the Turkish border in an arrangement that largely solidifies Turkey's position and aims in the weeklong conflict.

James Mattis mocks Trump insults: ‘I’m the Meryl Streep of generals’

Vice President Mike Pence, who reached the deal with Turkish President Recep Tayyip Erdogan, hailed the agreement as the way to end the bloodshed caused by Turkey's invasion.

But he remained silent on whether it amounted to a second abandonment of America’s former Kurdish allies, many of whom are branded as terrorists by Ankara. The deal includes a conditional halt to American economic sanctions and no apparent long-term consequences for Turkey for its actions.

Turkish troops and Turkish-backed Syrian fighters launched their offensive against Kurdish forces in northern Syria a week ago, two days after Trump suddenly announced he was withdrawing the U.S. military from the area.

Trump was widely criticized for turning on the Kurds, who had taken heavy casualties as partners with the U.S. in fighting IS extremists since 2016.

While U.S. officials have insisted that Trump did not authorize Turkey's invasion and only that he was not persuasive enough in making the case against it to Erdogan, the cease-fire codifies nearly all of Turkey's stated goals in the conflict.

Turkish Foreign Minister Mevlut Cavusoglu said the United States had accepted the idea of a "safe zone" long pushed by Turkey, and he insisted Turkish armed forces will control the zone. He also made clear that Turkey will not stop at a previously limited zone; he said Turkish control of the Syrian side of the border must extend all the way to the Iraqi border.

Caught in the middle, the commander of Kurdish-led forces in Syria, Mazloum Abdi, told Kurdish TV, "We will do whatever we can for the success of the cease-fire agreement." But one Kurdish official, Razan Hiddo, declared that Kurdish people would refuse to live under Turkish occupation.

Trump seemed to endorse the Turkish aim of ridding the Syrian side of the border of the Kurdish fighters. "They had to have it cleaned out," he said.

During a campaign rally in Texas on Thursday night, Trump said, “Sometimes you have to let them fight, like two kids in a lot, you got to let them fight and then you pull them apart.”

In the negotiations, a senior U.S. official said, Pence and national security adviser Robert O'Brien expressed condolences to Erdogan and his military commanders over their dead and injured in the week-long campaign.

Leading U.S. lawmakers were less than pleased than Trump.

Sen. Mitt Romney, the Republicans' presidential nominee in 2012, said he welcomed the cease-fire but wanted to know what America's role in the region would be and why Turkey was facing no consequences for its invasion.

"Further, the cease-fire does not change the fact that America has abandoned an ally," he said on the Senate floor.

A senior U.S. official insisted that the agreement was negotiated in consultation with Kurdish forces, and Pence said the U.S. would "facilitate" the Kurds' pullout, but he did not say if that would include the use of American troops.

The Pentagon had no immediate comment.

As Pence was speaking in Ankara, U.S. troops were continuing to board aircraft leaving northern Syria. Officials said a couple of hundred had already departed, with hundreds more consolidated at a few bases waiting to move out.

Sen. Lindsey Graham, a Trump confidant who has criticized the Republican president's pullout, said he thinks U.S. troops will be needed as part of an effort to implement and enforce a halt to the fighting.

"There's just no way around it," he said. "We need to maintain control of the skies" and work with the Kurds.

While the cease-fire seemed likely to temporarily slow legislation in Congress aimed at punishing Turkey and condemning Trump's U.S. troop withdrawal, lawmakers gave no sign of completely dropping the measures.

Shortly before the announcement of the pause in hostilities, Graham and Sen. Chris Van Hollen, D-Md., introduced legislation that would bar U.S. military aid to Turkey, seek to curb foreign arms sales to Ankara and impose sanctions on top Turkish officials unless Turkey withdraws its forces. Those sanctions would include a report on Erdogan's family assets.

In contrast with Pence's description of a limited safe zone, the agreement would effectively create a zone of control patrolled by the Turkish military that Ankara wants to stretch for the entire border from the Euphrates River to the Iraqi border, though the agreement did not define the extent of the zone. Turkish forces currently control about a quarter of that length, captured in the past nine days.

The rest is held by the Kurdish-led forces or by the Syrian government military, backed by Russia, which the Kurds invited to move in to shield them from the Turks. None of those parties has much reason to let Turkish forces into the areas.

But the agreement essentially gives the Turks what they had sought to achieve with their military operation in the first place.

After the Kurdish forces are cleared from the safe zone, Turkey has committed to a permanent cease-fire but is under no obligation to withdraw its troops. In addition, the deal gives Turkey relief from sanctions the administration had imposed and threatened to increase, meaning there will be no penalty for the operation.

Brett McGurk, the former civilian head of the administration's U.S.-led counter-IS campaign, wrote on Twitter that the deal was a gift to the Turks.

"The US just ratified Turkey's plan to effectively extend its border 30km into Syria with no ability to meaningfully influence facts on the ground," he wrote.

Danielle Pletka, vice president for foreign and defense policy studies at the American Enterprise Institute, tweeted, "This is a respite while we surrender to Turkish domination of Northeast Syria."

Erdogan had stated on Wednesday that he would be undeterred by U.S. sanctions. He said the fighting would end only if Kurdish fighters abandoned their weapons and retreated from positions near the Turkish border.

Before the talks, the Kurds indicated they would object to any agreement along the lines of what was announced by Pence. But Pence maintained that the U.S. had obtained "repeated assurances from them that they'll be moving out."

Trump’s withdrawal of U.S. troops has been widely condemned, including by Republican officials not directly associated with his administration. Republicans and Democrats in the House, bitterly divided over the Trump impeachment inquiry, banded together Wednesday for an overwhelming 354-60 denunciation of the U.S. troop withdrawal.