Turkey and Russia have agreed what they called a "historic" deal over military action against Kurds in northern Syria after a marathon diplomatic meeting.
The two powers had both stationed troops on the Turkey-Syria border after US troops withdrew from the area.
Turkey launched an offensive against Syrian Kurdish militias, parts of which it considers a terrorist group.
Now, Russia and Turkey will conduct joint patrols on the border, changing the power dynamic in the area.
The new deal came just ahead of the expiry of a ceasefire between Kurdish fighters and Turkish forces which had been brokered by the United States.
Kurdish fighters said they had completed their withdrawal under that agreement, but the deal agreed by Turkey with Russia has effectively extended it.
They have been given another 150 hours to withdraw to a depth of 32km (20 miles) from the border - a so-called "safe zone".
The Kurdish forces in northern Syria are dominated by the Kurdish People's Protection Units (YPG) militia, which Turkey considers a threat lying on its border.
The deal effectively splits military control of the region between Russia and Turkey, filling a role left vacant by the United States' sudden and unexpected withdrawal.