Turkish President Recep Tayyip Erdogan and his Russian counterpart Vladimir Putin have announced a military ceasefire in Idlib, after a meeting in Moscow that lasted six hours.

Idlib, the last rebel stronghold in Syria, has witnessed increased violence and bloodshed since last December, the start of a Russia-backed Syrian offensive to regain control over the region.

More:

"At 00.01 tonight, as in, from midnight, the ceasefire will be put in place," Erdogan told reporters on Thursday in the Russian capital.

Erdogan added that Turkey, which has sent thousands of troops into Idlib to repel the Syrian army, would not "remain silent" if Syrian government forces continued attacks and warned that Ankara would retaliate with full force.

Putin said Russia did not always agree with its Turkish partners but hoped the deal will serve as a "good basis for ending the fighting in the Idlib de-escalation zone, put an end to [the] suffering of [the] civilian population and contain a growing humanitarian crisis."

Even as the ceasefire came into effect, Turkey's state-owned Anadolu news agency reported early on Friday that Turkish forces killed 21 Syrian troops and destroyed two artillery pieces and two missile launchers, in retaliation of the killing of two Turkish soldiers in Idlib earlier on Thursday.

Since last December, more than 300 civilians, including at least 100 children, have been killed in Idlib.

Nearly one million people have been internally displaced to the border with Turkey, most of them forced to camp out in the open - the worst humanitarian crisis in Syria's nine-year-old civil war, according to the United Nations.

Erdogan on Thursday said the two leaders agreed to help these refugees return to their homes.

Turkey and Russia on Thursday also agreed to establish a secure corridor along a key east-west highway in Syria's Idlib and hold joint patrols on it as of March 15.

In a joint statement read out by the Turkish and Russian foreign ministers, the two sides said the secure corridor would stretch 6km (3.7 miles) to the north and 6km to the south of the M4 highway.

They said their defence ministers would agree on the parameters of the corridor within a week.

Presidents Erdogan, (left), and Putin shake hands after their joint news conference following their meeting in Moscow, Russia on March 5, 2020 [Sefa Karacan/Anadolu]

Until the latest crisis, Putin and Erdogan had managed to coordinate their interests in Syria even though Moscow backed Syrian President Bashar al-Assad, while Ankara supported the opposition forces.

Earlier on Thursday, al-Assad accused Turkey's president of "supporting terrorists".

"Erdogan is unable to tell the Turks why he is sending his army to fight in Syria and why his soldiers are being killed there because the issue has nothing to do with Turkish interests but with his Muslim Brotherhood ideology," he told the state-owned Russia 24 channel.

The Idlib crisis marks the first time Ankara has launched a direct offensive against al-Assad's forces.

Al Jazeera's Hashem Ahelbarra, reporting from Hatay on the Turkish-Syrian border, said Erdogan managed to get some "huge concessions" in the talks with Putin.

"I think this is going to be seen as a massive victory for Erdogan," Ahelbarra said. They got the ceasefire plus the safe corridors and also resettlement of the civilians back into their areas.

"Erdogan won't have to be concerned about his soldiers. Also, Turkey has been very concerned about a protracted conflict in Idlib that would pave the way for four million civilians to cross into Turkey. I think now those are some of the people that will be able to go back to their villages."

After dozens of his troops were killed in Syria, Erdogan has threatened Europe with a fresh migratory crisis by allowing refugees to travel on to Europe from Turkey, which he said can no longer handle new waves of people fleeing war-torn Syria.

On Thursday, Putin offered his condolences to Erdogan over Turkish losses in a Syrian air attack but noted there were also deaths among Syrian forces.

The two Turkish soldiers who were killed in an attack in Idlib on Thursday raised the number of Turkish soldiers killed since the beginning of February to 60.

After Turkey downed several Syrian jets, Moscow warned Ankara its aircraft would be unsafe if they enter Syrian airspace - a veiled threat to engage Russian military assets in Syria.

Fighting continued on Thursday in Idlib during the talks in Russia. Opposition activists there blamed Russian aircraft for an attack 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 has not singled out residential areas.

'Ceasefire agreed is very shaky'

Despite Thursday's breakthrough, hopes for peace among some Syrians remain low.

Raja Androon, a 65-year-old Syrian from Idlib whose two sons were killed by Syrian government forces, now lives in Antakya in southern Turkey.

"The talks may result in less fighting, but I'm not holding my breath for the Syrian regime to get out of Idlib," she told Al Jazeera. "I hope Idlib will come under autonomous rule, and not fall under Assad's control."

Mustafa Sejari, an analyst and member of the Syrian opposition Mutasim Brigades, was also sceptical, saying that Erdogan and Putin were trying to save face regarding their interests on the ground, "and nothing more".

He told Al Jazeera: "The regime will not withdraw from Idlib ... The ceasefire agreed upon is a very shaky one, and from the first violation of it the battles will resume once again.

Makeshift shelters of internally displaced Syrians are seen from a hill top in Idlib [Umit Bektas/Reuters]

"According to the press conference, safe passage will be allowed for the displaced civilians to return to their homes. However, where will they return to if the Syrian regime forces are still on the ground? Previous examples have shown that opening a humanitarian corridor to allow aid through will not stop Russia from continuing to bomb civilians."

According to the volunteer organisation White Helmets, 612 Syrian civilians have been killed by government forces and their allies since the beginning of this year.

Alexey Khlebnikov, Middle East expert at the Russian International Affairs Council, told Al Jazeera: "I think it's pretty obvious that Russia got what it wanted ... Of course it won't guarantee that no violations will occur, but judging by previous deals, this will be more sustainable.

"Both cannot afford a direct confrontation anyway, they've spent years building a relationship. For Turkey, the buffer zone close to their border is the most crucial: they don't want Syrian forces to go further north. The problem in this deal is that Ankara stands alone in the effort - or not - to solve the problem of 'terrorists' in Idlib province. But the pressure on Erdogan is mounting, and I think they'll have to accept to do something about it."

Anton Mardasov, a Moscow-based Middle East analyst, said: "The Kremlin maintains the status quo in Idlib and pressures Turkey to restructure the opposition ... and will control the roads.

"Some points remain unclear, though. In principle, Assad is not supposed to interfere, but we'll see how that goes."

With reporting by Linah Alsaafin in Antakya and Julian Colling in Moscow.