ISTANBUL (AP) -- Ankara and Moscow are again facing an escalation of violence in Syria's last rebel-held territory, a development that puts their cooperation to the test even as they support opposing sides in the eight-year war that has devastated Syria.
An all-out offensive by Syrian government forces to capture Idlib in northwestern Syria from insurgents could unleash an unprecedented humanitarian crisis, for the area is home to 3 million people.
Turkey, which is already hosting more than 3.6 million Syrian refugees, is facing strong pressure from Syria, Iran and Russia to deliver on its pledge to control the armed rebel factions in Idlib.
But Turkey also needs Russia to rein in Syrian President Bashar Assad to prevent a massive outflow of refugees and to keep Turkish soldiers on the ground safe.
Turkish President Recep Tayyip Erdogan and Russian President Vladimir Putin "have an incentive to cooperate and ensure that nobody's interests are totally trampled," says Aaron Stein, the director of the Middle East program in American think-tank Foreign Policy Research Institute.
In September, the two leaders brokered a cease-fire for Idlib in the Russian resort of Sochi, preventing a bloody onslaught, despite the fact that Russia has firmly backed Assad and Turkey supports opposition forces. Nine months later, the truce has failed.
The agreement called for a 15-to-20 kilometer (9-to-12 mile) demilitarized zone free of insurgents and heavy weaponry and for two key highways crossing through Idlib to be reopened. The demilitarized zone has been breached and the highways are at the center of the current government offensive.
Syrian ground forces have been advancing from the south of the rebel stronghold under the cover of Syrian and Russian airstrikes.
The Syrian Observatory for Human Rights said more than 291 civilians and 369 fighters have been killed since April 30 in the rebel stronghold. In the same period, 269 government troops and 22 civilians were killed in government areas by rebel fire. The U.N.'s children's agency said more than 130 children have reportedly been killed.
Already, more than 200,000 people from the stronghold have been displaced, according to the U.N., with some seeking safety near the border with Turkey while others crammed into already crowded camps in Syria.
Turkey has accused the Syrian government of violating the cease-fire and Turkish Defense Minister Hulusi Akar said the country has told Russia "the regime must be controlled."
Russia has launched airstrikes in Idlib and is providing air cover in the Syrian government offensive. It has complained that the militants have increasingly been targeting its military base in the nearby coastal province of Latakia.
But for now, Moscow is unlikely to support an all-out Syrian operation in Idlib because the benefits of a long-term alliance with Turkey outweigh one military battle.
"Russia doesn't want to ruin its relationship with Turkey because of Idlib," says Kirill Semenov, a Moscow-based Middle East analyst and expert at the Russian International Affairs Council.
In late April, Putin said he would not rule out a large-scale assault but "together with our Syrian friends, we believe that this would not be advisable" due to humanitarian issues.
Still, Russia's patience is wearing thin with the Hayat Tahrir al-Sham, or HTS, which it accuses of targeting its military base. HTS is considered a terrorist organization by the United States, Russia and Turkey, despite its claims it has disassociated from al-Qaida.
Top Russian officials have often called Idlib a "breeding ground for terrorists."
Despite the cease-fire deal, Turkey has been unable to neutralize the extremists. Much of Idlib has come under the control of HTS, which has defeated Turkey-backed armed groups.
Emre Ersan, an associate professor of international relations and political science at Istanbul's Marmara University, believes Turkey may have overestimated its influence over HTS. He says Turkey's plan to split the group, with some of its members joining Turkish-backed opposition forces and the group's hard-liners isolated, has not worked.
Instead of coming under the umbrella of moderate groups, HTS has used Turkey as leverage against Russia and Assad-supporter Iran, according to Ersan.
Adding to the risks, Turkish troops are in the line of fire. Two Turkish soldiers were wounded in early May in a Syrian government artillery attack on an observation post. Three other attacks have been cited by Turkey's official Anadolu Agency, raising the question if the attacks were accidental or designed to pressure Ankara with Russia's knowledge.
"The Turkish Armed Forces will not take a single step back from where it is," Akar, Turkey's defense minister, said last week.
Erdogan and Putin have talked on the phone, agreeing to continue working along the lines of the cease-fire agreement to prevent civilian deaths and a refugee flow. They also agreed to meet on the sidelines of next month's Group of 20 conference in Japan.
"Apart from this dialogue and cooperation, there is nothing on the ground that can prevent a catastrophe in Idlib," Ersan says.
The presidents have become close since 2016, rebuilding their relations after a dramatic crisis in 2015 when Turkey shot down a Russian jet near the Syrian border. Their rapport comes amid Turkey's fragile relations with NATO ally United States, especially over Washington's support of Syrian Kurdish-led forces who control large swaths in eastern Syria. Ankara considers them an extension of a Kurdish insurgency operating inside Turkey.
Erdogan is so far sticking to his promise to buy Russian-made S-400 missiles despite U.S. warnings the system would jeopardize Turkey's participation in the F-35 fighter jet program and compromise its safety. Stein calls this "a big win for Russia." Turkey is angling for a way to have both the S-400s and the F-35s.
Turkey is also talking with the U.S. about a safe zone in northeastern Syria and has repeatedly asked for the U.S. to end its military support for Kurdish-led Syrian Democratic Forces, or SDF. Erdogan will meet U.S. President Donald Trump at the G-20 as well.
Ersan believes Russia may allow Turkey to grab the northern town of Tel Rifaat from the Kurdish fighters, the last town they control in western Syria. Russian support could help Turkey put pressure on the SDF, widen Turkish influence and strengthen its hand in ongoing negotiations with the U.S.
In exchange, he argues, Turkey could be open to some limited Syrian operation toward Idlib.