SOCHI, Russia/ANKARA (Reuters) - Turkey and Russia agreed on Tuesday to remove the Syrian Kurdish YPG militia to beyond 30 km (19 miles) from the Turkish border, after which their troops will jointly patrol a narrower strip of land in a “safe zone” Ankara has long sought in northern Syria.

Beginning at noon (0900 GMT) on Wednesday, Russian military police and Syrian border guards will move in to facilitate the removal of YPG members and weapons to beyond the zone in a mission that should take about six days, according to the deal.

Russian Foreign Minister Sergei Lavrov hailed the deal as one that would end the bloodshed in the region, while Turkish President Tayyip Erdogan said Turkey had no designs on Syrian territory as it continued to push the YPG south.

The YPG, the key component in the Syrian Democratic Forces (SDF) that have for years fought alongside U.S. troops against Islamic State, will also leave the towns of Tel Rifaat and Manbij under the deal struck between Erdogan and President Vladimir Putin in the Russian Black Sea resort of Sochi.

“The main aim of the operation is to take out PKK/YPG terror organizations from the area and to facilitate the return of Syrian refugees,” Erdogan told a joint news conference with Putin.

Ankara regards the YPG as terrorists because of their ties to the outlawed Kurdistan Workers Party (PKK), which is waging an insurgency in southeast Turkey.

“This operation also guarantees Syria’s territorial integrity and political unity... We never had any interest in Syria’s land and sovereignty,” Erdogan added.

Once the YPG are removed, Turkish and Russian troops will conduct joint patrols in northern Syria within 10 km of the border, according to the deal.

Erdogan added that Ankara would also work with Moscow for the safe return of Syrian refugees now in Turkey.