ANKARA (Reuters) - Turkish President Tayyip Erdogan told Russia’s Vladimir Putin on Friday that Syrian army attacks in northwest Syria are causing a humanitarian crisis and threaten Turkey’s national security, the Turkish presidency said.

FILE PHOTO: Turkish President Tayyip Erdogan addresses his supporters during a ceremony marking the third anniversary of the attempted coup at Ataturk Airport in Istanbul, Turkey, July 15, 2019. REUTERS/Murad Sezer/File Photo

Syrian troops have encircled rebels and a Turkish military post in northwest Syria in an offensive to reclaim territory and towns they lost early in the war.

The military observation post near the town of Morek is one of 12 which Turkey established in northwest Syria under a deal with Moscow and Tehran two years ago to reduce fighting between Syrian President Bashar al-Assad’s forces and rebels.

Turkey has supported some rebel factions in the northwestern Idlib region, while Russia and Iran back Assad.

In the phone call, Erdogan told Putin that the Syrian army attacks violated a ceasefire in Idlib and damaged efforts for a solution in Syria, the Turkish presidency said.

“The president stated that the regime’s ceasefire violations and attacks in Idlib are causing a big humanitarian crisis, that these attacks are damaging the solution process in Syria and pose a serious threat to our country’s national security,” it said.

The Turkish Presidency later said Erdogan planned to make a one-day visit to Russia on Aug. 27.

Speaking at an event to mark the anniversary of his AK Party’s foundation, Erdogan also said he would discuss developments in northwestern Syria in a phone call with U.S. President Donald Trump in the coming days.

The recent advances by Assad’s forces have put Turkish troops stationed in the region in the firing line and displaced hundreds of thousands of people, threatening Ankara’s hopes of preventing a fresh wave of refugees on its southern border.

Turkish Foreign Minister Mevlut Cavusoglu called for an immediate end to the fighting but said Turkish troops were staying put at the Morek observation post out of choice, not necessity.

“Nobody can keep our forces and soldiers trapped. We are discussing this issue with Russia and Iran,” Cavusoglu told a news conference in Lebanon.

“We are there not because we cannot get out, but because we do not want to get out. We are there in accordance with the deal we made with Russia.”