Thousands of rival demonstrators hit the streets of Cologne as Turkish President Recep Tayyip Erdogan opened the country's largest mosque at the end of his visit to Germany.
The inauguration on Saturday capped a controversial three-day state visit aimed at repairing frayed ties with Berlin after two years of tensions.
During his stay in Berlin, Erdogan met twice with Chancellor Angela Merkel for talks, with both leaders signaling their interest in a cautious rapprochement, but also disagreements in a wide variety of issues.
The German Chancellor stressed that "deep differences" remained on civil rights and other issues, while Erdogan blamed Germany of harboring terrorists.
Erdogan supporters gathered near the Cologne Central Mosque as police cordoned off a large area around the mosque for safety reasons.
However, thousands of Erdogan supporters spilled into the side streets, hoping for a glimpse of the Turkish leader.
Many waved Turkey's red and white flag or held up pictures of Erdogan, with crowds cheerfully breaking into regular chants of the president's name or shouting "Who is the greatest? Turkey".
Both Cologne mayor Henriette Reker and the state's premier Armin Laschet declined to attend the mosque opening ceremony.
The snubs echoed the lukewarm welcome the Turkish leader received at a state dinner on Friday evening hosted by German President Frank-Walter Steinmeier, which several opposition politicians boycotted. Merkel also skipped the banquet.
Ties between the two NATO countries soured after Berlin criticized “Ankara's crackdown on opponents” following a failed 2016 coup, which saw 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.
But she also highlighted Germany's interest in a "stable" Turkey, which she relies on to help stem the flow of refugees to Europe.
Erdogan, seeking international allies as he spars with US President Donald Trump and a struggling lira, likewise struck a conciliatory tone.