Eight Turkish military personnel and at least 13 Syrian government troops have been killed as the two sides traded fire in Syria’s Idlib province, in a significant escalation in the battle to control the country’s last opposition stronghold.

Turkey sent a large military convoy across its southern border into Idlib overnight in an effort to secure its border and stem the bloodshed caused by a ferocious regime assault on the area carried out with the help of Russian airpower.

Approximately 390,000 people, 80% of whom are women and children, have fled their homes since 1 December, the UN says, and another 400,000 have been driven to the Turkish border since April.

Artillery shelling on Turkish positions near the flashpoint town of Saraqeb early on Monday killed five soldiers and three civilian contractors and injured seven more soldiers, the Turkish defence ministry said, adding that 30-35 troops fighting for Bashar al-Assad had been killed in retaliatory attacks. The war monitor the Syrian Observatory for Human Rights put the number of Syrian dead at 13, while the Syrian state news agency reported zero casualties.

Elsewhere in the rebel-controlled territory on Monday, airstrikes killed nine civilians – four children, three women and two men – who were fleeing the violence on a minibus near the village of Kfar Naha in the Aleppo countryside, paramedics and the Observatory said.

The Turkish military maintains 12 observation posts in Idlib to monitor a 2018 deescalation agreement that has been frequently violated by both sides.

The new regime offensive led Turkey, which backs some Syrian rebel groups and does not want to absorb more refugees, to make a rare threat of military force against Assad and his allies if the assault continued.

Turkey’s defence ministry said Turkish forces were sent to Idlib as reinforcement and attacked there despite prior notification of their coordinates to the local authorities.

The claim was disputed by officials in Moscow, who said Ankara had failed to notify them of troop movements overnight in Idlib and that the Turkish soldiers were hit by Syrian fire that was directed at “terrorists”, a reference to al-Qaida-linked militants west of Saraqeb.

While Turkey has intervened militarily in Syria three times to date in cross-border operations against Islamic State and US-backed Kurdish-led forces it regards as a terrorist threat, Monday’s clash was a rare direct confrontation against Assad’s troops and allied militias.

Turkey, which is home to about 4 million Syrian refugees, is unwilling to open its border to more.

Despite being on opposing sides Moscow and Ankara have largely sought to coordinate their actions in Syria. Although Turkey is dependent on Russian cooperation to continue its operations in Syria’s northeast, and despite the two countries’ trade, energy and defence links, Monday’s developments point to growing friction in the relationship. Further fighting between Turkish and regime forces could risk a serious escalation in Syria’s nine-year conflict.

“If Russia is unable to control the Assad regime from targeting us, we will not hesitate to take actions against any threat, just as we did today in Idlib,” the Turkish presidency’s communications director Fahrettin Altun wrote on Twitter.

Also speaking on Monday, the Turkish president said the operation in Idlib was ongoing and reiterated a warning to Assad’s backers in Moscow not to stand in the way of the Turkish action.

“Those who test Turkey’s determination regarding Syria’s Idlib with such treacherous attacks will realise their mistake,” Recep Tayyip Erdoğan told reporters before his departure from Ankara for Ukraine.

Idlib and the surrounding countryside are nominally protected by a de-escalation agreement brokered by Moscow and Ankara in September 2018. Fighting in the area has steadily worsened, however, since Hayat Tahrir al-Sham (HTS), al-Qaida’s former Syrian affiliate, emerged as the dominant group in the area last year.

Damascus and Moscow say the HTS takeover legitimises the campaign against Idlib as they are targeting terrorists not covered by the ceasefire deal who have bolstered attacks on government-held Aleppo.

Aid agencies and rescue workers, however, say airstrikes have demolished dozens of hospitals, schools and other civilian infrastructure, and warn that Idlib’s population of 3 million is at risk of the conflict’s biggest humanitarian crisis yet.

Thousands of families are currently sheltering in schools, mosques and tents near the Turkish border without adequate food or medicine in the winter weather.

The latest ceasefire attempt for Idlib on 12 January was ignored by the Syrian government, which instead accelerated its efforts, capturing several villages and the key town of Maarat al-Numan on the strategic M5 highway last week.