Whoever will be president of the Republic of Turkey in two months’ time will have the difficult task of rebuilding trust with EU leaders. The challenge is linked to both Turkey’s foreign policy and to its domestic situation.

During the past few years, Turkey’s foreign policy has been a subject of perplexity for European leaders. While the country is solidly anchored to NATO (and hence benefits from Patriot missiles’ protection on its southern border), it has tended to play outside NATO’s policies in several ways. For example, Turkey has touted the purchase of a Chinese missile defense system totally incompatible with NATO standards and procedures. And it has long left an open door to jihadists going back and forth on the Syrian-Turkish border, to the point that journalists have dubbed the Istanbul-Hatay and Istanbul-Gaziantep flights “the jihad Express.” Rumors of arms deliveries to Syrian fighters and of harboring the Islamic State of Iraq and the Levant (ISIL) leader al-Baghdadi in Turkey at one point have added to the misgivings of the West.

Now, more trouble is brewing on Turkey’s southern borders: more than 80 Turks taken hostage by ISIL, the prospect of a dismantled Iraq, the possible emergence of a Kurdish state spanning over parts of the current Syrian and Iraqi territories, the likelihood of a shrunken Syria (from Lattakia to Damascus) ruled by a surviving Bashar al-Assad regime with vast lands left to extremist warlords. Things have become greatly more complicated for Turkey.

One way to rebuild consistency and trust is to control the jihadists at the Turkish-Syrian border: instead of calling “tourists” the thousands of European and Arab fighters who have gone to or come back from Syria, Turkey would be better off implementing tight controls at its borders, regional airports and Istanbul airports. Lists have been given by European intelligence services, cooperation has been offered and controls have been tightened at the European end of the circuit. So, the time has come to show solid counter-terrorism results, not just proclamations. In the final analysis, Turkey is as exposed to “returnee jihadists” as are France, Belgium or Spain and its security depends on strong cooperation with Europe and the U.S.

Another critical area in which Turkey must improve its credentials with the EU is the state of its rule of law. For a number of reasons, Turkey’s rule of law architecture has been largely dismantled during the past year: judiciary procedures have been halted, serious allegations have not been investigated, the Supreme Council of Judges and Prosecutors (HSYK) has lost a large part of its independence, media freedoms have been further restricted, Internet and social media usage has been hampered and dissent has been quelled in a harsh manner. As repeatedly stated by European politicians, none of the above is EU-compatible. Therefore, the next president of the Turkish Republic will have the massive task of rebuilding the rule of law if the country is intent on proving that it is heading toward EU standards and norms.

Often times, Turkish politicians have complained that their country was “not treated as an equal” by the EU. It is certainly true that, in many European countries and political parties, there is a diffuse sense that Turkey is “bad for Europe.” A first, simple measure to counter effectively this unfair perception would be to stop invoking “European conspiracies” (or American for that matter) every time top politicians are in trouble on the domestic scene. This is simply not fitting the normal behavior within the EU club. Notwithstanding Turkey’s taste for conspiracy theories, it is urgent to realize that such theories are not things of our times anymore and they increasingly look like easy escapes when there is no better explanation. It does not work in the EU, and a large proportion of Turkish citizens are unconvinced.

Within the EU club, differences are plenty and consensus hard to nurture. Yet, EU leaders try hard to achieve common positions. Take, for example, the military ousting of Mohamed Morsi as president of Egypt a year ago. Turkey has repeatedly and publicly criticized the EU for not condemning it. One can indeed see the point of principle. But does this sharp, public criticism of both Egypt’s current rulers and the EU leave Turkey in a more influential position? No, it leaves it isolated. Being a country negotiating its EU accession would suppose a degree of constructive convergence with the EU’s attitude, including on Egypt.

Similarly, the frequent reasoning heard from Turkey that the EU is “in deep crisis,” “divided and polarized,” doesn’t sound much like the narrative of an ardent applicant for membership. Becoming a trusted strategic ally of the European Union will take quite a few steps from the next president of the Turkish Republic in order to rebuild trust and show on which side of the spectrum the country wants to sit. It will be a tall order.

This article was originally published on Hürriyet Daily News.