EUROPE’S relations with Turkey have long been coloured by mutual fascination, dependence and mistrust. Spellbound after visiting Constantinople in 1898, Kaiser Wilhelm II of Germany wrote to his friend Tsar Nicholas II, “If I had come there without any religion at all, I certainly would have turned Mahommetan!” But if today’s Europeans rely on this awkward partner to keep refugees away and share intelligence on terrorists, Turkey’s slide into paranoid authoritarianism under President Recep Tayyip Erdogan makes it a far less enticing partner. Jean-Claude Juncker, president of the European Commission, said this week that Turkey is leaving Europe with “giant steps”.

The relationship is complicated by the economic and military ties that bind Turkey and Europe, but above all by the large number of Turks, and their descendants, living in Europe. The Turkish diaspora numbers over 6m, most of them in western Europe. For years Mr Erdogan has delivered rousing speeches to vast rallies in cities like Cologne, urging European Turks to make their way in their adopted homes but to reject attempts at assimilation—and hinting that the triumphs he has brought Turkey are theirs to share. Mr Erdogan is the first Turkish leader to take the diaspora seriously, and it shows. In a referendum in April 59% of diaspora Turks backed his controversial proposals to extend presidential powers, compared with just over half at home. Mr Erdogan has three aims in attending to the diaspora, says Sinan Ulgen, an analyst in Istanbul: to advance Turkish interests abroad, to seduce nationalists at home, and to stack up votes in his deeply polarised country.

Some European politicians have long bristled at Mr Erdogan’s electioneering in their cities. But their number has increased as Turkey’s relations with European governments, especially Germany’s, have crumbled amid Mr Erdogan’s obsession with rooting out supporters of Fethullah Gulen, an exiled cleric, following last year’s failed coup. In July Turkish police arrested six human-rights activists, including a German citizen. A furious Sigmar Gabriel, Germany’s foreign minister, issued a travel warning and threatened to cut off credit guarantees to firms investing in Turkey. Mr Erdogan has also sharpened his rhetoric. Before his referendum he accused the Dutch and German governments of “Nazi” tactics after they barred his ministers from campaigning. He has urged European Turks to have at least five children in order to counter the EU’s “vulgarism”. His government and its proxies have stepped up complaints about Islamophobia in Europe, and delight in highlighting instances of hypocrisy among Europe’s governments, such as allowing Kurdish terrorist groups to demonstrate.

Relations between Turkey and the EU democracies have degenerated further in the run-up to Germany’s election on September 24th. Mr Erdogan has called on Turkish Germans to shun both parties in the ruling coalition, as well as the Greens, for showing “enmity” to Turkey. German politicians these days seem to be competing to criticise Mr Erdogan’s government. Germany now wants the EU to consider cutting budgetary support to Turkey worth billions of euros, and to suspend customs talks.

The modern era of German-Turkish relations began with a guest-worker treaty signed in 1961, one of several agreed upon by West Germany after the Berlin Wall starved its booming economy of eastern European labour. The Turkish workers were meant to leave after two years, but this rotation clause was removed at the request of employers who liked the hard-working immigrants. Yet for decades West German governments maintained the fiction that the workers would one day go home, even as they imported their families and sent their children to local schools.

A troubled history

The debate eventually moved on; in 2000 legal changes made it much easier for Turks to acquire German nationality. But discrimination persists. “I can understand people supporting Erdogan,” says Kemal Dikec, a Turkish-German from Cologne who distrusts the president. “They think, ‘I’m not on my own any more.’”

Plenty of Turks in Europe take little interest in their motherland. In Germany turnout for the referendum was only 49%, and the 800,000 who are citizens only of Germany were not eligible to vote. Yet politicians remain disturbed by Mr Erdogan’s success in harvesting diaspora votes. “It’s a disaster that people who grew up in a free democratic land voted for Erdogan’s constitutional changes,” says Serap Güler, state secretary for integration in North Rhine-Westphalia, Germany’s most populous state and home to a third of its Turks.

Ms Güler, herself of Turkish extraction, considers this the “bill” for Germany’s years of failed integration policies, but for others the referendum revived old concerns about split loyalties. Turkey’s shoddy treatment of some dual citizens, such as Deniz Yücel, Die Welt’s Turkey correspondent, detained in Istanbul since February, has given German sceptics of liberal citizenship rules a fresh argument. In the Netherlands, which started thinking about integration many years before Germany, Turkey’s behaviour nonetheless feeds a touchy debate about the role of Muslim minorities. Nearly three-quarters of Dutch Turks backed Mr Erdogan’s referendum (see chart 1). German anxieties are fuelled by long-standing concerns over “parallel societies”. The phrase can feel relevant in neighbourhoods like Mülheim in Cologne, where televisions blare with Turkish news and cafés hum with gossip from Istanbul and Ankara. But the data tell a more complex story. Three-quarters of second- and third-generation Turkish-Germans have regular contact with other Germans, compared with less than half of the first generation (who still account for around 50% of Germany’s Turkish population). Surveys find German Turks growing less attached to conservative ideas like confining women to the home. Some are forging identities apparently grounded in beliefs they associate with Turkey, even as their behaviour points elsewhere: they are less likely than their forefathers to attend mosque, but more likely to say they are religious. Detlef Pollack, a sociologist who studies Germany’s Turkish population, interprets support for Mr Erdogan not as a rejection of democracy but as an expression of defiance, identity and perhaps resentment. “The message [of the vote] is: please take us seriously,” he says. “We are democrats, but not on your terms.”

Yet problems are legion. Surveys by the Essen-based Foundation for Turkish Studies find that Turkish-Germans in North Rhine-Westphalia are increasingly likely to consider Turkey “home” (see chart 2); ever fewer say the same for Germany. Socioeconomic indicators are especially bleak. Reiner Klingholz at the Berlin Institute for Population and Development, a research outfit, lists a few: among migrant groups in Germany Turks have the highest share of people without schooling, the lowest rate of university attendance and, at 50%, the highest rate of women staying at home. The gap is closing, especially for girls, but far too slowly. Analysts tend to pin much of this on the background of the guest workers. Over two-thirds of adult Turks who arrived in the 1960s and 1970s, many originally from poor and conservative parts of eastern Anatolia, had no qualifications. Their children often floundered in German schools, which sort by ability early and struggle to provide opportunities to pupils from poor backgrounds. Studies from the OECD put Germany near the bottom of the table in getting migrant-origin children into decent schools, although its apprenticeship system is good at finding them work. Germany’s migrant communities by and large lack the aura of helplessness that can afflict parts of French or Belgian cities.

DITIB of the spear

European countries fear not just support for Mr Erdogan among their Turkish populations, but the import of Turkey’s pathologies. Since the attempted coup in July 2016, Turkish-German businesses suspected of Gulenist sympathies have been boycotted and their owners harassed. Turks in Germany lower their voices when asked about politics, and political scientists report difficulties in finding Turkish interviewees. “People are increasingly unable to look into each other’s eyes,” says Cahit Basar, a Kurdish activist from Cologne.

Such clefts have been aggravated, German officials charge, by organisations such as DITIB—the German branch of Diyanet, the religious arm of the Turkish state—which was established by secular Turkish governments in the 1980s as a counter to more conservative outfits. Observers accuse DITIB of replicating Diyanet’s politicisation of religion; some imams have been recalled from Germany by Diyanet after allegations that they had spied on their own congregations. German ministers have suggested that the Cologne-based DITIB should sever its ties with the Turkish state. (Ayse Aydin, a spokeswoman, says it is unfair to treat a handful of the 800 imams it employs as representative.) Other countries have had difficulties: in Belgium, Flemish authorities withdrew official recognition from one of the country’s biggest mosques over spying allegations.

DITIB is no stranger to controversy. It has built a striking mosque, Germany’s largest, in Cologne, spooking locals who disliked the visible intrusion of Islam into this traditionally Catholic city. The prayer room, flooded with light from huge windows designed to foster “transparency”, recently opened to worshippers; a mini-mall downstairs aims, as Ms Aydin puts it, to “lower fear and contact barriers” for non-Muslims, who will be invited to patronise the (halal) outlets when they open later this year. It speaks of a newly confident German Islam even as it serves the needs of a less assured generation. “I can’t think of Germany as home,” says Recep, a middle-aged mechanic brought to Cologne as a child by his Anatolian parents, as headscarved teenagers cheerfully pose for selfies before the mosque’s soaring minarets.

DITIB’s efforts in Cologne are impressive, but face stiff hurdles. Fully 60% of Germans believe that Islam does not belong in their country. A virulent anti-Muslim group, PEGIDA, was at one point in 2015 attracting thousands of people to rallies, though it has since faded. Rows between governments affect everyday interactions, too. Many Turkish-Germans say they feel that they must demonstrate opposition to Mr Erdogan to earn the trust of their compatriots; last year Mrs Merkel urged them to “develop a high degree of loyalty to Germany”. Non-partisan organisations struggle to position themselves between their commitments to human rights and what they see as exploitation of the referendum by German politicians.

But Angela Merkel’s government also faces a difficult balancing act: it must stand up to Turkey’s current excesses without alienating Germany’s considerable pro-Erdogan element. Mr Gabriel recently published an open letter assuring Germany’s 3m-plus Turks that they belonged in the country. But for many of them it came too late. Mr Erdogan’s supporters in Germany are more interested in his successes than the endless Turkey-bashing they hear at home. “Europe wants to keep Turkey small,” says Ari Ihsan, a fan of the president encountered in Mülheim. “Why shouldn’t we live like Europeans?”