More than half a million people have been displaced in Syria’s last rebel stronghold by a deadly regime offensive that has led Turkey to intervene in the fighting and has raised tensions between Damascus, Ankara and Moscow.

Weeks of intensive aerial bombardment by the forces of Bashar al-Assad and his Russian allies and a bruising ground offensive have emptied entire towns in north-west Idlib province and sent huge numbers of civilians fleeing north towards the Turkish border.

On Monday, a rare exchange of fire between newly deployed Turkish troops and Assad’s forces killed eight Turkish military personnel and at least 13 Syrian troops, the most significant clash between the two sides in the nine-year-old conflict.

On Wednesday, the Turkish president, Recep Tayyip Erdoğan, said if Syrian government forces did not pull back to an earlier ceasefire line by the end of the month, Turkey would take further military action.

Erdoğan said he had reiterated the ultimatum to the Russian president, Vladimir Putin, Assad’s main backer, during a late-night phone call on Tuesday. The recent violence has tested the already brittle relationship between Ankara and Moscow, the key foreign brokers of the conflict.

“This is a new era in Syria. Nothing can remain the same where the Turkish soldier’s blood has been shed,” Erdoğan told politicians from his ruling party.

“The air and ground elements of the Turkish armed forces will freely move in the Idlib region and if needed will launch an operation,” he added.

The Turkish president is seeking to shore up a de-escalation agreement for Idlib brokered in 2018 by Moscow and Ankara, which supports some rebel groups in the area. The ceasefire has been routinely broken by both sides, but regime attacks have escalated since Hayat Tahrir al-Sham (HTS), formerly al-Qaida’s Syrian affiliate, seized control of the area last year. A full-scale air and ground offensive began in December.

The violence has put Idlib’s population of 3 million at risk of what aid agencies say could be Syria’s worst humanitarian crisis yet. Turkey, already home to around 4 million refugees, is unwilling to open its border to more.

“Since 1 December, some 520,000 people have been displaced from their homes, the vast majority – 80% – of them women and children,” said David Swanson, a spokesperson for the United Nation’s humanitarian coordination office, OCHA.

The exodus, coinciding with a biting winter, is one of the largest since the start of the conflict in 2011, since when more than half of Syria’s pre-war population of 20 million have been displaced from their homes, sometimes several times.

Mohammad Bahjat, 34, said he and his family had escaped bombardment for a third time in days. “We fled in the middle of the night and have no idea where to go,” he told Agence France-Presse, sitting in the front of a pickup truck next to his wife and three small boys. “You never know when a rocket or shell is going to hit.”

The UN secretary general, António Guterres, has called the escalation “extremely worrying” and appealed for a cessation of hostilities.

Syrian forces have retaken dozens of villages and some towns, including the former rebel bastion of Maaret al-Numan, and continue to advance, pushing displaced populations ever closer to the Turkish frontier.

Syrian soldiers and allied militia groups have seized much ground in the enclave’s south and are also attacking from Aleppo province to the east, taking more than 20 settlements from rebels and jihadists over the past 24 hours, according to the Syrian Observatory for Human Rights and the Syrian state news agency Sana.

In the town of Hazano, an AFP correspondent saw dozens of small trucks and vans piled high with belongings crawling along a main road. They advanced bumper to bumper, carrying men, women and children along with blankets, carpets, washing basins and furniture.

Almost 300 civilians have been killed since mid-December by bombardment in the Idlib region, according to the Observatory.

UN experts said on Tuesday the latest attacks on Idlib could constitute violations of international law.

The UN’s independent international commission of inquiry on the Syrian Arab Republic cited reports of “attacks on civilian infrastructure, including schools, markets, and medical facilities” in the last two weeks.

“The deliberate and systematic targeting of hospitals follows a pattern already documented by the commission and may amount to war crimes,” it said in a statement.