Turkey and Russia have agreed what they say is a "historic" deal aimed at keeping Kurdish forces away from Syria's border with Turkey.
It comes during a pause in Turkey's offensive to drive Kurdish forces out, creating a "safe zone" in the area.
Under the deal, Syrian and Russian forces will immediately oversee a withdrawal of Kurdish forces.
There is no word from the Kurdish fighters, whom Turkey regards as terrorists.
The deal sets out plans for joint Turkish-Russian patrols along the border next week.
The agreement was announced after six hours of talks on Tuesday between Turkish President Recep Tayyip Erdogan and his Russian host, Vladimir Putin, in the Black Sea resort of Sochi.
A ceasefire brokered by the US was set to expire on Tuesday evening and Turkey had threatened to re-launch its offensive against the Kurdish fighters. It said there was now "no need".
The Turkish offensive began after the US announced a sudden and unexpected withdrawal of its troops from northern Syria. The US troops had been supporting the Kurdish fighters, who have been allies in the fight against the Islamic State (IS) group in the region.
What was agreed in Sochi?
In its offensive, Turkey seized a 120km-long strip of land between the towns of Ras al-Ain and Tal Abyad - part of its attempt to create a "safe zone" to resettle up to two million refugees currently in Turkey and remove the Kurdish fighters.
Under the deal, Russia has agreed to allow Turkish troops to remain in the area they have taken and to retain sole control.
Kurdish fighters have been given 150 hours from midday on Wednesday (09:00 GMT) to pull back 30km (18 miles) along almost the whole frontier from the Euphrates, just east of Manbij, to the Iraqi border.
Russian and Syrian forces will move in immediately to oversee the Kurdish pullback.
The area around Qamishli, which has a large Kurdish population, is not included and no immediate details were given as to what would happen there.
After the 150-hour deadline expires on 29 October, Turkish and Russian troops will begin joint patrols in areas described as "in the west and the east of the area" of the Turkish offensive.
The statement from Russia and Turkey also says Kurdish forces "will be removed" from Manbij and the town of Tal Rifat, 50km to the west of Manbij - both of which lie outside the operation area.
Kurdish militias and political leaders have made no immediate comment on whether they will agree to the demands.
Syria's President Bashar al-Assad has raised concern about foreign interference in Syria but the Kremlin said he had thanked President Putin and "expressed his full support for the results of the work as well as the readiness of the Syrian border guards, together with the Russian military police, to reach the Syrian-Turkish border".
Iran's foreign ministry said the deal was a positive step and that it backed any move to restore stability in the region.
How did we get here?
A US-led coalition relied on Kurdish led forces to battle IS militants in northern Syria over the past four years, but they are dominated by the Kurdish People's Protection Units (YPG) militia, which Turkey sees as a terrorist organisation.
Just over two weeks ago President Donald Trump announced that he would be withdrawing US troops from Syria. Soon after, Turkey launched an offensive on the Kurds.
Russia stationed troops near the border over concerns that Syria's territory was being encroached upon by a foreign power.
Turkey agreed to pause the assault last week at the request of the US to "facilitate the withdrawal of YPG forces from the Turkish-controlled safe zone".
The ceasefire largely held, despite what US officials have described as "some minor skirmishes".
What has the cost been?
The UN says more than 176,000 people, including almost 80,000 children, have been displaced in the past two weeks in north-east Syria, which is home to some three million people.
Some 120 civilians have been killed in the battle, along with 259 Kurdish fighters, 196 Turkish-backed Syrian rebels and seven Turkish soldiers, according to the Syrian Observatory for Human Rights (SOHR), a UK-based monitoring group.
Twenty civilians have also been killed in attacks by the YPG on Turkish territory, Turkish officials say.