Altun was referring to the People’s Protection Units (YPG), the Syrian Kurdish force that drove the battle against the Islamic State under the umbrella of the US-backed Syrian Democratic Forces (SDF).

Turkey viewed itself as the day’s biggest victor, with #TurkeyWon top trending on Twitter. Erdogan’s top communications man, Fahrettin Altun, summed up feelings in a series of tweets. “The separatist terrorist organization’s project to build a statelet has been relegated to history.”

The 10-point memorandum marks a formal end to the joint US-Kurdish condominium in northeastern Syria and the resumption of Syrian regime control for almost the full length of the border in what is being billed as a safe zone. More broadly, it cements Russia’s role as the main power broker in Syria, with all the attendant burdens.

“Together with Mr. Putin, we have signed an historic agreement that secures the fight against terrorism, the territorial integrity of Syria and the return of refugees,” a tired yet triumphant Erdogan said at a joint news conference with the Russian leader.

Turkish President Recep Tayyip Erdogan announced what he termed “a historic agreement” with Russia today after six hours of talks with his Russian counterpart Vladimir Putin in the Black Sea resort of Sochi.

Turkey considers the group to be terrorist because of its ties to a Kurdish militia that has been waging an armed insurgency against the Turkish state for the past 35 years. Washington’s alliance with the group has strained relations between the NATO allies to the breaking point and driven Turkey into Putin’s embrace.

The agreement says Russian and Syrian government forces will start removing the YPG from the border region lying east of the Euphrates, which the Syrian Kurds previously controlled with the United States. The YPG will pull back along with their weapons to a depth of 30 kilometers (19 miles) from the Turkish border. Then Turkish and Russian forces will begin to patrol the area. This mirrors many of the elements of Thursday's deal between Turkey and the United States that followed Turkey’s Oct. 9 Peace Spring offensive against the YPG.

Aaron Stein, director of the Philadelphia-based Foreign Policy Research Institute’s Middle East program, told Al-Monitor, “It's the same basic deal the United States was offering, albeit with the provision that the Kurds will be plugged back into the central government, ending [their] state-building project.”

Analysts agree that Syria’s long-repressed Kurds have suffered massive reversals from the wave of game-changing developments over the past two weeks, which saw President Donald Trump effectively greenlight the Turkish invasion, allowing Turkey to seize the towns of Tell Abyad and Ras al-Ain. Despite the ensuing uproar from Congress amid gross rights abuses by Turkey’s rebel allies, Trump went on to announce that he was pulling out nearly all US troops from northeast Syria.

The administration has nonetheless continued to toy with the idea of keeping residual forces in Deir ez-Zor near the Iraqi border. "We haven't collapsed our bases there yet and the regime doesn't have a presence there yet and the SDF wants us to stay on," an administration official told Al-Monitor. But today’s deal will likely free Trump’s hand. He has wanted out from “endless wars” since taking office but has encountered fierce resistance from his own bureaucratic picks, notably his special representative for Syrian engagement, Ambassador Jim Jeffrey. “We can engage in fantasy of a US role here. The US has no role,” said Stein.

Scores of civilians have died and at least 160,000 others have been displaced since the Turkish assault began. The United Nations Office for the Prevention of Chemical Weapons has begun to investigate claims that Turkish-backed forces used white phosphorus against civilians. The allegations surfaced when photographs and video of footage of children with horrific burns began circulating. One of the children captured on film, his tiny body blackened and screaming in pain, was transferred to a hospital in Iraqi Kurdistan and is to be flown to Paris for treatment. Turkey denies it is using chemical weapons or white phosphorus, which under the appropriate circumstances can be used legally in combat as a smokescreen in daytime and to illuminate targets at night.

The Kurdistan Regional Government in Iraq is bracing for an influx of Syrian Kurdish refugees and has set up three separate camps that can accommodate up to 250,000 of them, an Iraqi Kurdish official told Al-Monitor. The Iraqi Kurdish region already hosts some 228,000 Syrian refugees fleeing the eight-year conflict. The UN said that as of today, more than 7,100 refugees had crossed from northeast Syria into Iraq. Three out of four were women and children.

Should Erdogan’s plans materialize, the Kurds fleeing Syria would be replaced by up to 2 million of the estimated 3.6 million Syrians currently sheltering in Turkey. Resettling refugees was one of the articles in the Sochi agreement. Erdogan announced a million would repatriated in an initial phase and further million thereafter.

The scheme is viewed by the Kurds as nothing less than ethnic cleansing.

“The Kurds are definitely the biggest losers,” said Samuel Ramani, an Oxford-based scholar who studies the Syrian conflict. There was no immediate reaction from the SDF.

Erdogan said some 800 YPG fighters had already left the 32-kilometer (20-mile) deep Operation Peace Spring area in keeping with the five-day cease-fire deal sealed between Turkey and the United States on Thursday. The pause in fighting was set to expire tonight. Erdogan said some 1,200 or more YPG fighters remained but were exiting rapidly.

Still, today’s deal is not necessarily as great as Turkey claims. Ramani told Al-Monitor, “Turkey has less leeway than it did under the US. The way I see this Russia is in control of the enforcement.” Ramani was alluding to a proposed mechanism that is meant to enforce implementation of the agreement. More likely Russia will use it to extract concessions from Turkey, notably over the rebel-held province of Idlib.

“Putin stands up to Erdogan, unlike [Vice President Mike] Pence and Trump,” said a source with close knowledge of the administration’s Turkey policy.

Erdogan sought to deflect speculation that today’s deal was brokered in exchange for Turkish acquiescence for a full-blown regime offensive against Idlib. “The de-escalation in tensions in Idlib is a positive development,” Erdogan said.

Syrian President Bashar al-Assad today vowed to retake the province along with all other areas that have fallen out of his hands during a rare visit to the front lines. Assad used the opportunity to lambaste Erdogan, who sought to overthrow him in the early days of the conflict, saying, “Erdogan is a thief and is now stealing our land.”

On Monday, Iran, one of the other main stakeholders in Syria, said it rejected the establishment of Turkish military posts inside Syria. “Syria’s territorial integrity should be respected,” said Iranian Foreign Ministry spokesman Abbas Moussavi, prompting angry rebukes from Erdogan.

“I strongly condemn Iran,” Erdogan said today.

There was no mention of any Turkish bases being set up in the proposed Turkish-Russian safe zone, something the United States intimated Turkey could eventually get under the US-Turkey deal. “Turkey is not getting any new territory under its control,” said Kerim Has, a Moscow-based Turkish analyst of Russian affairs. Nor is there any mention of disarming YPG fighters.

Amid all the tough talk there is growing consensus that Turkey will be forced to mend fences with Assad, as will the Kurds; in both instances, Russia will likely be the broker.