MOSCOW -- The presidents of Russia and Turkey said they reached agreements on a cease-fire to take effect at midnight Thursday in northwestern Syria, where escalating fighting had threatened to put forces from the two countries into a direct military conflict.
Russian President Vladimir Putin and Turkish President Recep Tayyip Erdogan also said the deal also envisions setting up a security corridor along a strategic highway in Idlib province.
Putin voiced hope the deal will serve as a "good basis for ending the fighting in the Idlib de-escalation zone, put an end to suffering of civilian population and contain a growing humanitarian crisis."
Erdogan said he and Putin agreed to help refugees return to their homes. More than 900,000 people have been displaced by the fighting since the forces of Syrian President Bashar Assad launched an offensive in December.
Both leaders had underlined the need to reach agreement at the start of the Kremlin talks, which lasted more than six hours. One goal had been to prevent damage to their bilateral relations and blossoming Russia-Turkey trade.
The Russian and Turkish foreign ministers said the agreement involves a cease-fire that must be enforced starting at midnight along existing battle lines. The deal also envisages setting up a 12-kilometre (7-mile) -wide security corridor along the M4 highway. The corridor will be jointly patrolled by Russian and Turkish troops, starting March 15.
Until the latest crisis, Putin and Erdogan had managed to co-ordinate their interests in Syria even though Moscow backed Assad while Ankara supported the government's foes throughout Syria's nine-year war. Both Russia and Turkey were eager to avoid a showdown but the sharply conflicting interests in Idlib province made it difficult to negotiate a mutually acceptable compromise.
A Russia-backed Syrian offensive to regain control over Idlib -- the last opposition-controlled region in the country -- has resulted in Turkey sending thousands of troops into Idlib to repel the Syrian army. Clashes on the ground and in the air have left dozens dead on both sides. Russia, which has helped Assad reclaim most of the country's territory, has signalled it won't sit by while Turkey routs his troops now.
The fighting has also pushed nearly 1 million Syrian civilians toward Turkey. Erdogan responded by opening Turkey's gateway to Europe in an apparent bid to persuade the West to offer more support to Ankara.
Just before sitting down with Erdogan, Putin discussed the situation in Idlib with European Council head Charles Michel who met the Turkish president in Ankara on Wednesday. The Kremlin said Michel informed Putin about the EU's efforts to block the flow of migrants.
Putin offered Erdogan his condolences over Turkish losses in a Syrian airstrike, but noted that Syrian troops also suffered heavy losses. Another Turkish soldier was killed in an attack in Idlib Thursday, raising the number of Turkish soldiers killed since the beginning of February to 59.
"The world's eyes are on us," Erdogan had said. "The steps we will take, the right decisions we will take here today will help ease (concerns in) the region and our countries."
After Turkey had downed several Syrian jets, Moscow warned Ankara that its aircraft would be unsafe if they enter Syrian airspace -- a veiled threat to engage Russian military assets in Syria.
Russian warplanes based in Syria have provided air cover for Assad's offensive in Idlib.
Opposition activists in Idlib blamed Russian aircraft for Thursday's strike on a rebel-held village which they said killed at least 15 people, including children, and wounded several others. The Russian military had no immediate comment on the claim, but it has staunchly denied similar previous claims insisting it hasn't targeted residential areas.
The fighting in Idlib is the most severe test of Russia-Turkey ties since the crisis triggered by Turkey's downing of a Russian warplane near the Syrian border in November 2015. Russia responded then with an array of sweeping economic sanctions, cutting the flow of its tourists to Turkey and banning most Turkish exports -- a punishment that eventually forced Turkey to back off and offer apologies.
Turkey can't afford a replay of that costly crisis, far less a military conflict with a nuclear power, but it has a strong position to bargain with. Moscow needs Ankara as a partner in a Syrian settlement and Russia's supply routes for its forces in Syria lie through the Turkish Straits.
Moscow also hopes to use Ankara in its standoff with the West. Last year, Turkey became the first NATO country to take delivery of sophisticated Russian air defence missile systems, angering the United States. Turkey has put its deployment on hold, however, amid the crisis in Idlib.
The talks in Moscow mark the 10th meeting in just over a year between Putin and Erdogan, who call each other "dear friend" and have polished a fine art of bargaining.
In October, they reached an agreement to deploy their forces across Syria's northeastern border to fill the void left by President Donald Trump's abrupt withdrawal of U.S. forces. Prior to that they had negotiated a series of accords that saw opposition fighters from various areas in Syria move into Idlib, and in 2018 carved out a de-escalation zone in Idlib.
They blamed one another for the collapse of the Idlib deal, with Moscow holding Ankara responsible for letting al-Qaida linked militants launch attacks from the area and Turkey accusing Moscow of failing to rein in Assad.
Thursday's deal would allow Assad to secure control of the key strategic M4 and M5 highways spanning Syria, which his forces claimed in the latest offensive. The M5 links Damascus with Aleppo, the country's commercial capital, while the M4 crosses Idlib to reach the Mediterranean province of Latakia, where Russia has its main base. The highways are essential for Assad to consolidate his rule.
In a sign that the Kremlin firmly intends to secure control of the roads, earlier this week Russian military police deployed to the strategic town of Saraqeb, sitting on the junction of the two highways, to ward off any Turkish attempt to retake it.
In return, Putin appeared to accept the presence of Turkey-backed militants in the areas alongside the border and put brakes for now on Assad's attempts to claim full control over Idlib.