(AFP) — Turkish president Recep Tayyip Erdogan is set to open one of Europe’s largest mosques in Cologne on Saturday as he wraps up a controversial visit to Germany, with police deploying in force amid planned protests.

The inauguration will be the closing event of Erdogan’s three-day state visit, aimed at repairing frayed ties with Berlin after two years of tensions.

In talks with Chancellor Angela Merkel on Friday, both leaders signalled their interest in a cautious rapprochement, but Merkel stressed that “deep differences” remained on civil rights and other issues.

Some 10,000 Erdogan critics are expected to take to the streets in Cologne, protesting everything from Turkey’s record on human rights and press freedom to its treatment of minority Kurds.

Erdogan supporters meanwhile will gather at the Cologne Central Mosque, an imposing dome-shaped building next to the shadowy, Turkish-controlled Ditib organisation.

Cologne police said they were bracing for one of their biggest ever deployments, and that a maximum of 5,000 people would be allowed to attend the opening ceremony for safety reasons.

On its Facebook page, the Cologne branch of Ditib said it wanted the ceremony to be a “beautiful” example of both communities coming together, and asked attendees to refrain from bringing political banners or shouting slogans.

Both Cologne mayor Henriette Reker and the state’s premier Armin Laschet pulled out of attending the opening as criticism of Erdogan’s visit grew.

The snubs echo the lukewarm welcome the Turkish leader received the previous evening at a state dinner hosted by German President Frank-Walter Steinmeier, which was boycotted by several opposition politicians.

Merkel also skipped the banquet.

Study: Turkish Background Germans Increasingly Feel Closer Bond to Turkey Than Germany https://t.co/Ds5mzx45M9 — Breitbart London (@BreitbartLondon) July 31, 2018

Ties between the two countries soured after Berlin criticised Turkey’s crackdown on opponents following a failed 2016 coup, with tens of thousands arrested.

Tensions eased somewhat after several high-profile German-Turkish nationals were released this year, but five remain behind bars.

Merkel, whose country is home to more than three million ethnic Turks, stressed the need for continued dialogue to overcome disagreements, particularly “in questions about a democratic, open society”.

But she also highlighted Germany’s interest in a “stable” Turkey, a country she relies on to help stem the flow of migrants arriving on European shores.

Erdogan, seeking European allies as he spars with US President Donald Trump and the Turkish economy is in turmoil, likewise struck a conciliatory tone.

But he said Germany was doing too little to deal with thousands of Kurdish militants on its soil.

And he complained that Germany was refusing to extradite followers of Muslim cleric Fethullah Gulen, whom he blames for the coup attempt.

In a Berlin rally hours later, hundreds of mostly ethnic Kurdish demonstrators marched with banners that showed likenesses of Erdogan shooting a journalist and devouring a peace dove.

European Union Remains ‘Committed’ To Opening Borders to 75 Million Turkish Citizens as ‘Soon as Possible’ https://t.co/cR9gt1do7j — Breitbart London (@BreitbartLondon) November 29, 2017

Erdogan’s visit on Saturday takes him to North Rhine-Westphalia state, which is home to significant numbers of ethnic Turks, many who moved to Germany as so-called “guest workers” from the 1960s.

Several anti-Erdogan demos are planned in Cologne on Saturday, including one under the banner “Erdogan Not Welcome”.

They are expected to gather a few kilometres (miles) away from the neighbourhood of the mosque.

The giant Cologne Central Mosque opened its doors in 2017 after eight years of construction and budget overruns. It can house more than a thousand worshippers.

The sheer size of the building, designed to resemble a flower bud opening, and its two towering minarets has disgruntled some locals, triggering occasional protests.

The Turkish-Islamic Union of the Institute for Religion (Ditib) that commissioned the glass and cement structure is itself not without controversy.

The group runs hundreds of mosques across Germany, and its imams are paid by the Turkish state.

Known for its close ties to Ankara, it has increasingly come under scrutiny with some of its members suspected of spying on Turkish dissidents living in Germany.

German media recently reported that the domestic intelligence service was considering putting Ditib under surveillance.