The presidents of Russia and Turkey said they reached agreement on a cease-fire to begin at midnight Thursday in northwestern Syria, where escalating fighting had threatened to put forces from the two countries into direct conflict.
The deal struck by Russian President Vladimir Putin and Turkish President Recep Tayyip Erdogan also would set up a security corridor along a key east-west highway in Idlib province.
Putin voiced hope the agreement 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."
The agreement appears to achieve Russia's key goal of allowing the Syrian government to secure control over strategic highways essential for consolidating its grip on the country after a devastating nine-year war.
But in a nod to Turkey's interests, the deal also puts the brakes on Syrian President Bashar Assad's push to reclaim control over all of Idlib province, the last opposition-controlled region that borders Turkey.
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 Assad's forces began an offensive in December backed by Russian airstrikes.
Both leaders had underlined the need for an agreement at the start of the Kremlin talks, which lasted more than six hours. One goal had been to prevent damaging their bilateral relations and blossoming trade.
U.N. Secretary-General Antonio Guterres "takes note" of the cease-fire agreement and hopes it will lead "to an immediate and lasting cessation of hostilities that ensures the protection of civilians in northwest Syria, who have already endured enormous suffering," U.N. spokesman Stephane Dujarric said.
Guterres also called for a return to the U.N.-facilitated political process, aimed at ending the nine-year conflict, Dujarric said.
Until the latest crisis, Putin and Erdogan had managed to coordinate their interests in Syria even though Moscow backed Assad while Ankara supported the government's foes. Both Russia and Turkey wanted to avoid a showdown but the sharply conflicting interests in Idlib province made it difficult to negotiate a mutually acceptable compromise.
The Syrian offensive in Idlib has resulted in Turkey sending in thousands of troops 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 signaled it won't sit by while Turkey routs his troops.
The fighting also has pushed nearly 1 million Syrian civilians toward Turkey, which already hosts more than 3.5 million Syrian refugees. Erdogan responded by opening Turkey's gateway to Europe in an apparent bid to persuade the West to offer more support to Ankara.
He has frequently threatened to open Turkey's borders to Europe, maintaining that the European Union has not upheld its end of a more than 6 billion-euro deal designed to stem the flow of migrants after more than 1 million people entered the EU in 2015.
Putin discussed the situation in Idlib with European Council head Charles Michel, who met the Erdogan 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 military losses but noted that Syrian troops also suffered heavy casualties. Turkey's Defense Ministry announced that two more of its soldiers were killed Thursday, raising the number slain in Syria since the start of February to 60.
"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 on Sunday that its aircraft would be unsafe if they enter Syrian airspace.
Opposition activists in Idlib blamed Russia for Thursday's strike on a rebel-held village that they said killed at least 15 people, including children, and wounded several others. The Russian military had no immediate comment, but it has denied similar claims by insisting it hasn't targeted residential areas.
The fighting in Idlib is the most severe test of Russia-Turkey ties since Turkey's downed a Russian warplane near the Syrian border in November 2015. Russia responded then with 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.
Turkey can't afford a replay of that costly crisis, much less a military conflict with a nuclear power, but it has a strong bargaining position. 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 defense missile systems, angering Washington. Turkey has put its deployment on hold amid the crisis in Idlib.
The talks in Moscow marked 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 agreed 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. Before that, they had negotiated deals 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.
The Russian and Turkish foreign ministers said Thursday's agreement involves a cease-fire to be enforced starting at midnight along existing battle lines. The deal also envisages setting up a 12-kilometer (7-mile) security corridor along the M4 highway to be jointly patrolled by Russian and Turkish troops, starting March 15.
A security corridor along the M4 that crosses Idlib to reach the Mediterranean province of Latakia, where Russia has its main base, will help solidify Assad's gains and strengthen his control.
Earlier this year, Assad retook control of the M5 highway linking Damascus with Aleppo, the country's commercial capital. As part of their latest offensive, Assad's forces have pushed back the militants who were blocking it.
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 the deal with Erdogan, Putin appeared to accept the presence of Turkey-backed militants in areas alongside the border and put brakes for now on Assad's attempts to claim full control over Idlib. That compromise will allow Turkey to secure its stake in Syria and prevent refugees from fleeing across the border.
Soner Cagaptay, an expert on Turkey at the Washington Institute, said the agreement "freezes the conflict on the ground."
The fighting was not expected to flare up again until "the next moment when Putin feels emboldened enough to push further," Cagaptay said.
For his part, Erdogan avoided a situation where Turkey's borders would be overwhelmed by refugees, while also preventing a rupture with Russia, the analyst said.
Cagaptay also said Assad did not emerge the winner.
"His military capabilities have been undermined by Turkey," he said. "We witnessed a NATO country pummeling Assad's third-rate army."
Konstantin Kosachev, head of the Russian upper house's foreign affairs committee, hailed the deal as a compromise that respected security interests of each country.
"The only alternative to the talks would be trying to sort out the differences on the battlefield, and neither side needs that," he said on Facebook.