The Turkish and Russian presidents agreed Monday to create a “demilitarized zone” in Syria’s Idlib province, appearing to avert a bloody government assault on Turkey’s southern border.

Recep Tayyip Erdogan and his host Vladimir Putin signed the memo after four-and-a-half hours of negotiations in Sochi, Russia’s Interfax news agency reported.

“By October 15, Idlib will become a demilitarized zone. Militants including (former Al-Qaeda affiliate) Jabhat al-Nusra will be removed,” said Interfax citing Putin.

“I believe that with this memorandum, we have prevented a great humanitarian crisis in Idlib,” said Erdogan in comments published by Turkish state media.

The two leaders agreed to coordinate patrols for a 15-20 kilometer, or 9-12 mile, buffer zone between Syria’s armed opposition and troops loyal to Syrian President Bashar al-Assad. It was not immediately clear where the demilitarized zone would be located and if it would involve opposition factions pulling back and Assad’s forces recovering lost territory.

Following the memo signing, Putin said he would “soon hold additional consultations” with his Syrian allies, who had been counting on Russian support to retake the province.

Syria’s other key ally Iran has chosen to stay out of the Idlib showdown to avoid alienating Turkey.