Turkey is holding covert contacts with Syria's government to avert direct conflict in northeast Syria where both sides have deployed their armies, Turkish officials say, despite Ankara's long-standing hostility to President Bashar al-Assad.
Turkey's President Tayyip Erdogan backs rebels who fought to topple Assad during Syria's eight-year civil war. He described Assad as a terrorist and called for him to be driven from power, something which earlier in the war appeared possible.
But Assad's allies Russia and Iran helped turn the conflict round and with U.S. forces now withdrawing from northeast Syria, Assad's Russian-backed troops are sweeping back into the region just as Turkish troops move in from the north.
Warily, the two sides have set up channels of communication, both direct military and intelligence contacts and indirect messages through Russia, to reduce the risk of confrontation, three Turkish officials say.
"We have been in contact with Syria on military and intelligence issues for some time in order to avoid any problems on the field," a Turkish security official told Reuters.
He said contact was first initiated over a separate escalation in northwest Syria, when Russia-backed Syrian troops earlier this year launched an assault in the Idlib region where Turkish troops are deployed.
"Contact with Syria has largely been through Russia, but this communication was done directly between Turkey and Syria at times to avoid Syrian and Turkish soldiers engaging in direct confrontation," the official added.
While the Turkish government insists that it has not changed its stance towards Assad, the security contacts with Damascus reflect a growing reality that it cannot ignore the Syrian president's steady restoration of control over his country.
Russia's position as go-between also points to the central role played by Moscow - Assad's most powerful backer - in Syria since President Donald Trump said he was pulling U.S. troops out of northern Syria.
Erdogan and Russian President Vladimir Putin will meet in the Black Sea resort of Sochi on Tuesday for talks which are likely to shape the next steps in northeast Syria.
"We will also receive information about Syria's perspective and the steps it will take during the meeting with Putin," a senior Turkish official said.
The Kremlin declined to comment on the matter in any detail.
SYRIAN FORCES IN TURKEY'S "SAFE ZONE"
Turkey launched its cross-border offensive on Oct. 9, saying it aimed to set up a roughly 30 km (20 mile) "safe zone" along 440 km of border, driving back Kurdish-led forces and preparing to settle up to 2 million Syrian refugees it currently hosts.
The Turkish offensive, currently halted for a 120-hour pause which expires late on Tuesday, has focused on two Syrian border towns of Tel Abyad and Ras al Ain, which lie roughly in the middle of the border strip Turkey is targeting.
The Kurdish-led Syrian Democratic Forces (SDF) said on Sunday they had withdrawn from Ras al Ain, and Turkey has said it controls the other town, Tel Abyad.
Further west, however, Syrian and Russian forces have already deployed in the border towns of Manbij and Kobani, which are both located within Turkey's designated "safe zone".
Erdogan said last week he could accept Syrian forces entering Manbij as long as the Kurdish YPG militia, which is the main fighting force in the SDF and is considered a terrorist group by Ankara, was removed.
The Kurdish-led forces, who were Washington's main partners in the battle to dismantle Islamic State's self-declared caliphate in Syria, said last week they had held talks with Damascus about trying to stem the Turkish advances.
Despite backing opposing sides in Syria's conflict, Ankara and Moscow have grown closer, their ties strengthened by joint energy projects and Turkey's purchase of Russian air defences - to the anger of its NATO ally, the United States.
As Erdogan and U.S. Vice President Mike Pence hammered out a surprise Syria truce under the glare of international media on Thursday, Russia's Syria envoy quietly met Erdogan's national security aide in another part of the president's palace.
Syrian media reported that envoy Alexander Lavrentiev met Assad in Damascus the next day, without saying whether he had brought a message from Ankara.
A third Turkish official said Lavrentiev's talks in Turkey had focused on preparations for Erdogan and Putin's meeting.
Turkey and Russia have cooperated more closely on Syria since agreeing two years ago to work along with Assad's other main ally, Iran, to contain the fighting.
Turkey says it wants free elections in Syria overseen by the United Nations, and would work with whoever won power in a fair vote. It has also dropped its once frequent calls for Assad to go, although officials say that does not signal any shift.
"When it is necessary, there are of course contacts with Syria on intelligence, information sharing and other things," Foreign Minister Mevlut Cavusoglu said last week. "There is no contact whatsoever on a political level."