Turkey’s president, Recep Tayyip Erdoğan, has threatened Bashar al-Assad with direct military action if any more Turkish troops are harmed in escalating fighting over Syria’s last rebel stronghold.

Ankara and Damascus have moved closer to an all-out war in the past week than at any other point in Syria’s long conflict, in the wake of a ferocious regime assault on north-western Idlib province, on the border with Turkey. The violence has sparked the largest mass displacement of civilians in the nine-year-old war to date, killing at least 380 civilians and driving 700,000 people from their homes since December.

Idlib and the surrounding countryside are nominally protected by a 2018 de-escalation deal brokered by Turkey, which backs some of Syria’s rebel groups, and Russia, which supports Assad. In recent days, Turkey has dispatched reinforcements to bolster 12 Turkish military posts in the area established to monitor the ceasefire, sparking deadly clashes with Syrian government forces.

“The regime, backed by Russian forces and Iran-backed militants, are continuously attacking civilians, committing massacres and shedding blood,” Erdoğan told a meeting of his ruling party in parliament. “I hereby declare that we will strike regime forces everywhere from now on regardless of the [2018] deal if any tiny bit of harm is dealt to our soldiers at observation posts or elsewhere.”

Turkey would do “whatever necessary” to push back Syrian forces behind the 12 observation posts, he added, reiterating a previous ultimatum to Assad to retreat before the end of the month.

The Turkish leader’s comments were met with anger by the Kremlin, which in turn accused Ankara of breaching the 2018 deal by failing to contain Islamist elements in Idlib.

Facebook Twitter Pinterest Syrian men ride a motorcycle in the village of Maaret al-Naasan in Idlib province. An upsurge in violence has killed at least 380 civilians and driven 700,000 people from their homes since December Photograph: Omar Haj Kadour/AFP/Getty

Damascus also hit back at Erdoğan. The Syrian state news agency Sana quoted a source at the foreign ministry as saying his “empty statements” were “disconnected from reality”.

The Turkish deployment to Idlib does not appear to have had any stalling effect on the regime’s campaign. Syrian troops and allied militias have continued to push rebels and Islamist groups away from the key M5 highway, capturing a string of towns and villages in western Aleppo province since Tuesday night, according to pro-government media and the Syrian Observatory for Human Rights, a war monitor.

A regime helicopter gunship was allegedly shot down by rebel forces near a Turkish position on Tuesday, further heightening tensions.

A Russian delegation left Ankara on Monday night without having made any clear progress towards de-escalation. The Russian president, Vladimir Putin, and Erdoğan also spoke by phone on Wednesday.

The escalating violence has left hundreds of thousands of people camped out in tents on the Turkish border in sub-zero winter conditions. Turkey, which already hosts about 4 million refugees, fears a fresh influx from Syria and has kept its border closed.

Elsewhere in the country on Wednesday, one Syrian was killed and another wounded in a rare clash between US troops and a group of government supporters who tried to block an American convoy driving through a village in the Kurdish-controlled north-east, state media and activists reported.