Will rising Islamophobia in Europe provide Turkey with its entry ticket to the EU? Recep Tayyip Erdogan seems to think so. And the president of Turkey may be right — but for the wrong reasons.

On a visit last month to Somalia, where Ankara has undertaken a big humanitarian aid programme, Mr Erdogan said that Europe can succeed in fighting Islamophobia only if it agrees to accept Turkey as a member. His assertion rests on the claim that the fate of the Turkey-EU relationship will be critical in efforts to prevent further alienation of Europe’s Muslim population.

And, as highlighted by the reactions to last month’s murderous attacks in Paris, Europe is certainly in need of a more concerted effort to tackle the interlinked challenges of radicalisation and Islamophobia.

Mr Erdogan believes Turkey can contribute to these goals because of what it is: the only mainly Muslim nation with a secular democracy. But its ability to help Europe find greater harmony with its Muslim population will be determined by what it becomes. To prove the validity of Mr Erdogan’s argument, and inspire the citizens of other liberal democracies, Turkey must show it can establish its own version of a liberal democracy based on rule of law with a clear separation of faith from the state.

Yet during Mr Erdogan’s time in office the century-long drive to create such a model state has entered a critical stage. A counter-narrative is gaining ground, contending that the decision of past generations of ruling elites to anchor the country firmly in the west was mistaken. Not only will Turkey be shunned by Europe, according to this view — but, worse, westernisation has disconnected the country from its Islamic heritage and undermined its ability to achieve its manifest destiny of leading the Islamic civilisation. This counter-narrative champions a return to past greatness by restoring Turkey’s religious identity.

This clash of visions is creating its own problems. For instance, Turkey is the only Muslim country where a local newspaper, Cumhuriyet, published and distributed a version of the first issue of Charlie Hebdo printed after the attacks on the French satirical magazine. The addendum was devoid of the front-page cartoon of the Prophet Mohammed — an attempt at sanitisation deemed in¬sufficient by a public prosecutor intent on taking the daily to task for denigrating the religious values of citizens. Similarly, Prime Minister Ahmet Davutoglu joined other leaders in Paris to show support for press freedom — yet Turkey continues to slide backwards in global rankings on personal freedom. While state agencies strive to stem the flow of foreign jihadis intent on joining the Islamic State of Iraq and the Levant (Isis) in Syria, pro-Isis Turkish websites continue to disseminate unadulterated versions of their jihadist message.

Modern history, including Turkey’s, shows the futility of imposing a state-led vision on a large, heterogenous society. It can only lead to more social discontent and tension. Turkey can build a more peaceful, prosperous future for all citizens only if its body politic is willing to create the foundations of an inclusive and more democratic state. A re-engagement with Europe is the only way.

It was this vision of joining Europe which, in the not too distant past, motivated not just Mr Erdogan’s AK party but also the main opposition CHP to back fundamental democratic reforms.

Today, after Charlie Hebdo, there is even more reason for Europe’s leaders to embrace Turkey’s European dream unequivocally. If Turkey fails to consolidate the foundations of a genuine liberal democracy, and allows the divide between religion and state to dwindle, Europe’s efforts to make Islam a part of mainstream society at home will be hindered. Turkey itself will prove a less effective bulwark against the rising tide of extremism in the Middle East. For its part, Europe will be seen to have failed a test of the sincerity of its founding principles by turning its back on the only functioning effort to marry western and Islamic values. And sincerity is what Europe needs most today if it is to fight the ills of radicalisation and embrace its own Muslim citizens.

This article originally appeared in the Financial Times.