By Dominic Evans
ISTANBUL (Reuters) - Syrian army advances in northwest Syria are putting Turkish troops in the firing line and threaten Ankara's hopes of preventing a new wave of refugees on its southern border.
The offensive around Idlib, the last major rebel stronghold in Syria, has already forced tens of thousands of civilians to flee towards Turkey.
It has also cut off a Turkish military post deep inside Syria as the deal to limit fighting in the region, which the Turkish troops were supposed to be monitoring, collapses.
The breakdown of that deal would be a significant blow to President Tayyip Erdogan, who has steered Turkey closer to Russia in recent years but appears unable to rein back Moscow's support for the Syrian army offensive.
Russia, Iran and Turkey agreed in 2017 to set up four "de-escalation zones" to stem fighting between Syrian President Bashar al-Assad's forces and rebels, but the Syrian army has retaken three of those areas and is now advancing in the fourth.
It has entered the town of Khan Sheikhoun, effectively cutting off Turkish troops at a military post near the town of Morek, 70 km (45 miles) inside Syria. A Turkish convoy sent to resupply the Morek post was halted on Monday by an air strike.
"The situation there is of critical sensitivity," Erdogan's spokesman Ibrahim Kalin said after a cabinet meeting on Wednesday.
Turkey, which supports some Syrian rebel factions, has troops deployed at 12 military observation posts around the Idlib region under the 2017 deal with Moscow and Tehran, which back Assad's government.
That agreement, and a Turkey-Russia accord last year aimed at reducing the power of jihadist fighters in the Idlib region, has at best had only a limited impact.
Turkey complained that Syrian and Russia air strikes in the region continued, while Moscow grew increasingly impatient over what it saw as Ankara's failure to stop jihadists from the former Nusra Front taking over much of Idlib.
Russia also says the fighters in Idlib and Hama provinces threatened its Hmeymim air base, less than 40 km to the west.
Turkey insists it has no plans to abandon or move any of the military posts it set up in Idlib, despite Monday's air strike and the fighting around Morek.
"All observation posts will continue operations where they are located right now," Kalin said, adding that agreements to halt military operations around Idlib must be respected.
"Otherwise, both the violation of this agreement and the resulting humanitarian drama will be inevitable."
The United Nations says more than 500,000 people have been uprooted since the Syrian army began its offensive in late April, most of them escaping deeper into the rebel bastion and towards the border.
Turkey, which opened its border at the start of the Syrian conflict in 2011 and now hosts 3.6 million Syrian refugees, is determined to avoid another influx of civilians - or fighters.
It has built a wall along the 800 km Syrian border and says it has identified locations inside Syria to shelter a possible wave of people fleeing the fighting in Idlib.
"If there is this kind of movement to our borders we will take action and create shelters where we are going to accommodate displaced people outside our borders," Interior Minister Suleyman Soylu said this week.
He did not specify whether the camps would be in Idlib province or Turkish-controlled areas of northern Syria around the towns of Azaz, Al-Bab and Jarablus.
Turkey's determination to stand by all 12 of its military posts in Idlib was reiterated this week by the government, and a senior security official told Reuters Ankara was standing by its troops on the ground.
"Whichever observation post needs it, support is provided, the official said.
However, that will prove increasingly challenging for Turkey unless there is a change of course by Moscow or Damascus, which has repeatedly said it is committed to recapturing every inch of Syrian territory.
"The Turkish observation posts are not constituted to defend themselves and at least one of them has been encircled by Syrian regime forces," said Ozgur Unluhisarcikli from the German Marshall Fund. "When the risk of conflict rises too much, Turkey will probably retreat."
Erdogan will speak to Putin about Idlib as soon as possible, Kalin told reporters after the cabinet meeting.
Just last month, Turkish ties with Russia appeared stronger than ever as Erdogan took delivery of advanced S-400 Russian missile defence equipment - despite a threat of U.S. sanctions and strong lobbying by Washington to stall the deal.
Six weeks later, Moscow and Ankara's differences over northwest Syria appear irreconcilable and Turkey's Idlib strategy is in peril.
"The end state is clear," said Sinan Ulgen, a visiting scholar at Carnegie Europe and a former Turkish diplomat.
Pressure on the southernmost Turkish observation posts - those which are the furthest inside Syria - would spread to other Turkish positions as the Syrian army offensive continues, and Turkey would likely pull some troops back.
"It was a matter of time," Ulgen said. "To me the surprise is that it happened so soon after the S-400 episode. It proves how little leverage Turkey has gained with Russia."
(Additional reporting by Orhan Coskun and Tuvan Gumrukcu in Ankara, Ezgi Erkoyun in Istanbul and Andrew Osborn in Moscow: Editing by Angus MacSwan)