President Recep Tayyip Erdogan will be in Germany tomorrow, capping an effort by the two countries to try and open a new page in their relationship, which have been strained now for a number of years.

Realpolitik clearly has a hand in all this since the basic positions the two countries hold on issues that have divided them in the past remain in place. Many have to do with German criticism of the state of democracy, human right, and the rule of law in Turkey.

Ankara for its part complains about Germany’s toleration for supporters of the outlawed Kurdistan Workers Party (PKK), and its refusal to extradite those wanted in Turkey in connection with the abortive coup attempt in 2016.

Although some political gestures have been made on both sides to facilitate improved ties, basic differences remain.

Despite these differences, the release in February of Deniz Yucel, the German journalist of Turkish origin who spent a year in prison in Turkey for allegedly supporting the PKK, was a clear sign by Ankara that it wanted better ties with Berlin.

On the other hand, Berlin’s continued support for the migration deal Turkey negotiated with the EU in March 2016 requires it to keep ties with Ankara on a cooperative basis.

There are also German concerns regarding the state of Turkey’s economy. Chancellor Angela Merkel has openly stated that economic instability in Turkey would not be in Germany’s interest. Looking at the vast volume of trade and investments involved, it is not surprising that the Turkish and Germany business communities should have a stake in improved ties between the two countries.

During his “state visit” as the guest of President Frank-Walter Steinmeier, which officially starts on Friday, Erdogan will also be confronted by reminders of what Turkey under his rule looks like to many in Germany.

There will be demonstrations and scathing press commentary on his visit with politicians from different shades also jumping in the fray.

Erdogan’s advisors must have known from the start that he will face testy moments during his three day stay in Germany. How he manages to steer through all of this will, however, be crucial since all eyes will be on him.

He has made harsh and abrasive remarks in the past about German politicians and could face questions about this too. Restrained and diplomatic responses would of course be better.

The bottom line, which should be kept in focus, though, is that his visit, with all the fanfare that involves, is the product of necessity. Erdogan will also hold talks with Merkel which will be crucial with regard to a host of issues, from the troubled Turkish economy, to stabilizing Idlib in Syria.

This is not a test of whether “Germany needs Turkey more or Turkey need Germany more” either. Both countries need each other, sometimes for differing reasons, and sometimes for the sake of overlapping interests.

Turkish-German relations have always been a complex matter. The presence of 3.5 million Turks, an overwhelming majority of whom are Erdogan supporters, also represent a strong undercurrent in this relationship.

The rise of racism and Islamophobia in Europe, and increase in anti-western sentiments in Turkey lays another responsibility on the shoulders of the two countries. They have the capacity to cooperate against such destructive tendencies.

Meanwhile Germany will continue to remind Ankara of its obligations under European Law with regard to democracy, human rights and the rule of law. Erdogan insists Turkey remains on course for EU membership. If he really believes this then he and his government should not consider such reminders to be offensive, but act on them in line with their obvious desire to improve ties with Europe.