Russia and Turkey have agreed to ensure Kurdish forces withdraw from areas close to Syria's border with Turkey and to launch joint patrols, in a deal hailed as "historic" by President Recep Tayyip Erdogan.
After marathon talks in Russia's southern city of Sochi, Erdogan and his Russian counterpart Vladimir Putin announced the deal late Tuesday just hours ahead of a deadline for Turkey to restart its assault on Syrian Kurdish forces.
As the evening deadline passed, Turkey said there was "no need" to relaunch the offensive.
The agreement cements Russia and Turkey's roles as the main foreign players in Syria, after US President Donald Trump announced the withdrawal of American forces from the country's north earlier this month.
That announcement cleared the way for Turkey to launch a cross-border military push on October 9 against the Kurdish YPG militia, viewed by Ankara as "terrorists" linked to the outlawed Kurdistan Workers' Party (PKK).
Turkey has seized control of a "safe zone" inside Syria about 120 kilometres long (75 miles) and 32 kilometres deep.
Tuesday's agreement with Moscow will see it preserve that zone between the towns of Tal Abyad and Ras al-Ain, giving Ankara a crucial presence inside the country.
From noon (0900 GMT) on Wednesday, Russian military police and Syrian border guards will "facilitate the removal" of Kurdish fighters and their weapons from within 30 kilometres (18 miles) of the border.
This withdrawal must be finalised within 150 hours, according to a text of the agreement released after the talks.
Russian and Turkish forces will then begin joint patrols along the Turkish-controlled zone.
In the early hours of Wednesday, Turkey said it had been informed by the US that their withdrawal from the border areas had been "completed".
"At this stage, there is no further need to carry out a new operation," the defence ministry said in a statement.
Safe zone 'calm'
Putin said the decisions were "very important, if not crucial, to allowing us to resolve the acute situation on the Syrian-Turkish border."
In a phone call to the Russian leader, Syrian President Bashar al-Assad said in reference to the Kurds that "those with separatist designs were responsible for what events have come to".
However, he also stressed "his complete refusal of any invasion of Syrian land under any name or pretext", Syrian state news agency SANA said.
Assad has repeatedly said he will eventually restore government control over all parts of Syria.
After decades of marginalisation, Syria's Kurds have largely stayed out of the country's eight-year civil war, instead building their own institutions in the northeast of the country -- but they insist they never wanted secession.
The Syrian Observatory for Human Rights, a Britain-based war monitor, said the area of the "safe zone" was calm late Tuesday.
Erdogan had earlier threatened to resume Ankara's military offensive against Kurdish forces in Syria if they did not withdraw as agreed under a US-brokered deal.
A deadline for the withdrawal expired at 1900 GMT on Tuesday, with a Kurdish official telling AFP they had "fully complied" ahead of the deadline.
The Turkish operation "is ending, and everything will depend now on the implementation of these agreements," Russian Foreign Minister Sergei Lavrov said in Sochi.
Turkey's assault had sparked Western outrage and accusations of betrayal from the Kurds, whose frontline fighters were crucial in the battle against the Islamic State group in Syria.
Late Tuesday a senior Washington official said the United States is counting on Turkey and Kurdish fighters to fight off any IS resurgence in Syria.
"If they are not forced to face off against each other, we can rely on both of them against ISIS," James Jeffrey, Special Representative for Syria and the anti-IS coalition, told a US Senate panel.
Russia is a key ally of Assad and has demanded that Turkey respect the country's territorial integrity.
As the US troops began to withdraw last week, Russian forces moved in to support the Syrian army, whose help against Turkey was requested by the Kurds.
Erdogan said last week he was not bothered by the Damascus regime's return as what mattered to Ankara was pushing back the Kurdish fighters from the safe zone.
Despite being on the opposite sides of the Syria conflict, Turkey and Russia have been working together to find a solution to the war.
Tuesday's agreement said the two countries were determined "to combat terrorism in all forms... and to disrupt separatist agendas in Syrian territory".
The agreement said efforts would also be launched for the return of refugees to Syria "in a safe and voluntary manner".
Ankara has said some of the 3.6 million Syrian refugees in Turkey can be rehoused inside the safe zone.