ANKARA (Reuters) - Germany is prepared to offer humanitarian assistance to countries harboring Syrian refugees if it comes to an all-out government offensive in Idlib, Foreign Minister Heiko Maas said in Ankara on Wednesday.

Slideshow ( 9 images )

Damascus, backed by Russia and Iran, has been preparing an assault to recover Idlib, the last stronghold of active rebellion against Syrian President Bashar al-Assad.

Maas was in Ankara on a visit aimed at improving badly frayed relations between Germany and Turkey after a post-coup crackdown in which Ankara imprisoned tens of thousands of people, including some German citizens.

With Turkey’s economy in crisis after the United States imposed sanctions, officials from Germany, Europe’s richest country, see a chance to improve ties, potentially leading to improved conditions for the detained.

But events in Syria’s northwestern Idlib region dominated Maas’s meetings with Turkish President Tayyip Erdogan and Foreign Minister Mevlut Cavusoglu.

At a joint news conference, Cavusoglu said refugees from Idlib would likely flood into Turkey and European countries.

Turkey, which backs rebels against Assad, is sheltering 3.5 million Syrian refugees. The European Union already relies on Turkey to stem the flow of refugees whose mass arrival in Europe in 2015 boosted support for anti-immigrant political parties.

The leaders of Turkey, Russia and Iran are due to meet on Friday in Tehran and are expected to discuss the situation in northwestern Syria.

“Germany is prepared to redouble its humanitarian engagement if it comes to fighting along a broad front in the region,” Maas said at the news conference.

He said he had raised the question of detained Germans at his meetings in Ankara, but declined to be drawn on the substance of those discussions.

Erdogan is due to visit Berlin later this month.

Germany is home to a three-million-strong Turkish diaspora, the world’s largest, many of whom have dual citizenship. German officials believe they have little choice but to improve ties, despite concerns over the human rights situation in Turkey.

Critics of Chancellor Angela Merkel’s government warned Germany should not compromise on human rights issues for the sake of a rapprochement.

“Maas and the government must work to help other political prisoners as well as the seven German hostages in Turkey,” said Greens lawmaker Cem Ozdemir, himself of Turkish ethnic background. “Their only crime was to be doing their job as journalists or opposition politicians.”

Tens of thousands of people were detained in a crackdown that followed the 2016 failed coup.

Maas is also due to meet business leaders in Istanbul, a gesture meant by officials as a statement of confidence in the Turkish economy.