Russia and Turkey have struck a deal to jointly police northeastern Syria that they say will end two weeks of bloodshed, just hours before a ceasefire in the area was due to expire.
After a marathon meeting in the Black Sea resort of Sochi, Turkish president Recep Tayyip Erdogan said that the agreement would see Kurdish YPG militia pull back beyond a 30km "buffer zone" along the Turkish border.
Kurdish forces would also leave the strategic Syrian towns of Tel Rifaat and Manbij under the terms.
Russian foreign minister Sergei Lavrov hailed the deal as one that would end the fighting that has ravished the region for the last two weeks.
The United Nations said that more than 176,000 people have been displaced, including nearly 80,000 children, since Ankara launched its controversial cross-border incursion against Syrian Kurds.
Beginning at noon Wednesday, Russian military police and Syrian border guards will move in to facilitate the removal of YPG members and weapons. A task that will last six days, the deal said.
At that moment Russian and Turkish forces will begin joint patrols 10km into the buffer-zone area.
The agreement, if successfully implemented, will likely herald the end of Turkey's incursion in northern Syria. It may also consolidate the Syrian government's hold over northeastern Syria which until two weeks ago had been controlled by Kurdish-led Syrian Democratic Forces.
President Vladimir Putin opened the Tuesday press conference saying that Moscow “appreciates” Turkey’s national security concerns but insists “Syria must be free from foreign military presence.”
Mr Erdogan outlined the understanding saying: ”The main aim of the operation is to take out PKK/YPG terror organisations from the area and to facilitate the return of Syrian refugees.”
Ankara regards the YPG as terrorists because of their affiliation with the outlawed Kurdistan Workers Party (PKK), which is waging an insurgency in southeast Turkey.
“This operation also guarantees Syria territorial integrity and political unity. We never had any interest in Syria land and sovereignty,” he added.
The two presidents met as a five-day cease-fire between Turkish troops and Kurdish fighters in northeastern Syria was set to expire.
Under the earlier US-brokered deal, Kurdish forces were supposed to withdraw from Mr Erdogan’s desired 30km deep buffer zone.
But Kurdish commanders accused Ankara of violating the agreement and continuing to fire on their fighters preventing them from pulling back.
Turkey meanwhile accused the Kurds of breaking the truce by leaving 1,300 Syrian Kurdish fighters in the ceasefire area.
Turkey launched its controversial cross border incursion in northeastern Syria earlier this month to repel Kurdish forces who once fought alongside US soldiers against the Islamic State.
President Erdogan said it aimed to build a “safe zone” where he also hopes to repatriate some of the 3.5 million Syrian refugees currently living in Turkey.
But he has faced mounting condemnation for the operation which has displaced hundreds of thousands of people and killed at least 70 civilians according to the Syrian Observatory for Human Rights.
Amnesty International has also accused Turkey and its Syrian rebel allies of likely committing war crimes, including indiscriminate bombing of civilian areas and an execution-style killing of a Kurdish female politician.
Turkey has vehemently denied the allegations and dismissed claims made by Kurdish doctors that it has used chemical weapons or white phosphorus as “flagrant slanders”.
President Donald Trump, once a close ally of the Kurds, was accused of green-lighting the operation after announcing US troops would pull back from northern Syria and not intervene in the imminent Turkish attack.
He later ordered most of the 1,000 US troops stationed in the country to completely withdraw. Many of them were pelted with vegetables by angry Kurdish residents as they crossed Syria's border into Iraq on Monday.
Facing the Turkish incursion alone, the Kurds then struck a deal with President Bashar al-Assad to defend the borders.
It was a massive territorial win for the Assad regime who has deployed government troops to Kurdish-controlled areas for the first time in five years.
Under Tuesday’s deal, government border guards would assist Russian forces in the YPG withdrawal. There has yet to be any official response from the Kurdish side.
But the Kurdish Red Crescent issued a desperate plea shortly before the agreement was announced, saying that their “capacity” to meet a mounting humanitarian crisis “had ended’.
They said five hospitals and clinics were out of service and there there was not enough resources to look after the huge number of newly displaced.
“There are no shelters, not enough food, not enough medicines, not enough drinking water. The water pipeline, which got hit by an airstrike and served more than 500,000 people, is still not functioning. These people have gone a week without a water supply,” the statement added.