By David Sahl and Petra Wischgoll
COLOGNE, Germany (Reuters) - Turkish President Tayyip Erdogan wrapped up an ill-tempered visit to Germany on Saturday with a visit to Cologne, where a security lockdown kept supporters and protesters away from a ceremony to open the country's largest mosque.
Police snipers were stationed on rooftops and the area was cordoned off after the city authorities cancelled plans for up to 25,000 people to be allowed to gather outside the mosque, built by an Islamic religious organisation that has close ties to the Turkish state.
Germany had invited Erdogan for the three-day state visit in an attempt to mend ties hit by a crackdown on his opponents following a failed coup in 2016, hoping to secure the release of several of its citizens who remain in detention.
Chancellor Angela Merkel said after meeting Erdogan on Friday that "deep divisions" remain. On Saturday in Cologne, the Turkish leader sought to strike a conciliatory note.
"In a critical period, we have made a fruitful, successful visit to Germany," he told guests at the opening of the Central Mosque. "I stressed that we need to put aside our differences and focus on our common interests."
Yet he also called on Germany to crack down on Kurdish separatists, and complained that soccer star Mesut Ozil had been hounded out of the German national team after Germany's World Cup exit because of his Turkish roots.
"This racism has to end," said Erdogan.
At a banquet hosted by President Frank Walter Steinmeier on Friday night the Turkish leader, departing from his prepared remarks, accused Germany of harbouring terrorists, according to those present.
"Hate speech against Germany," ran the headline in Saturday's edition of best-selling daily Bild.
NEITHER BETTER NOR SIMPLER
Senior Merkel allies said the visit had been premature, and ruled out providing any fresh economic aid to Turkey, which has suffered a slump in its currency following the imposition of trade sanctions by Washington.
"The timing of this visit was wrong - it was far too early," Norbert Roettgen, chairman of parliament's foreign affairs committee, told the Funke newspaper group. "The Turkish-German relationship is neither better nor simpler after this visit."
In Cologne, a major centre of the 3 million-strong Turkish community in Germany, a few hundred Erdogan supporters gathered behind security barriers waving flags and wearing scarves in Turkey's red-and-white national colours.
"It's a great honour for us," said supporter Ali Tas of Erdogan's visit.
Around 1,000 protesters - including emigres and German left-wing activists - gathered on the opposite bank of the River Rhine after being denied permission to march through the city centre.
"I don't like that the German government is in cahoots with a head of state who locks up people, imprisons journalists and (ethnically) cleanses his own country," said a German man who gave his name as Goetz.
Regional chief minister Armin Laschet did not attend the mosque opening, citing the importance of separating state and religion. Other local civic leaders complained that they were not invited to the event.
Erdogan and Laschet met earlier at Cologne airport. They were to have held talks at a stately home, but the venue was switched after its owners objected.
(Reporting by Reuters TV; Additional reporting by Ezgi Erkoyun in Istanbul; Writing by Douglas Busvine; Editing by Andrew Bolton)