NOTHING excites the febrile intellects of Brussels more than analysing the theoretical underpinnings of European foreign policy. Entire tracts are devoted to the security strategy of the European Union, its neighbourhood policy, the countless “tools”, “instruments” and “levers” it has designed to help it advance its global concerns. A keen student can lose himself for hours in strategy papers and advisory memos to the policymakers supposedly shaping Europe’s place in the world.

When the EU signed a German-inspired deal with Turkey to help stem the flow of refugees late last year, none of this mattered a jot. Presented by European officials as a hard-nosed piece of statecraft, the “action plan” offers Turkey money, the prospect of visa-free travel inside the EU and an acceleration of its membership bid so long as the Turks keep the migrants away. It was one of the most important European foreign-policy initiatives in years, but there was not a sniff of strategy to it. It reeked of desperation.

Turkey-watchers in Europe and liberals inside Turkey were united in outrage. The Europeans were averting their gaze as Recep Tayyip Erdogan, Turkey’s president, was locking up journalists, harassing the opposition and prosecuting a bloody war against unruly Kurds—in an official EU candidate country, no less. The European Commission even postponed publication of its highly critical annual report on Turkey’s membership bid while Mr Erdogan’s party campaigned in national elections.

The deal seemed emblematic of a “realist” turn in European foreign policy. Ideas such as slashing aid to countries that refuse to accept the return of failed asylum-seekers are doing the rounds. Officials in international-development agencies tear their hair out as carefully nurtured relationships in Africa are tossed aside to make way for quick-and-dirty deals to ship back rejected migrants. Southern European countries fret that a plan to open EU markets to Middle Eastern exports (to create jobs for refugees) will crowd out their manufacturers.

This is not the Weltinnenpolitik (global domestic policy) that grand thinkers like Jürgen Habermas thought regional clubs such as the EU were well placed to cultivate. Instead, to borrow from the late American neoconservative Irving Kristol, Europeans have started to resemble liberals mugged by reality. It is easy to bleat about human rights when you are living in a peaceful, postmodern paradise; less so when you have millions of illegal migrants barging through your back door.

Europeans are hardly new to Realpolitik (the clue is in the word). There has long been a division of foreign-policy labour within the EU, says Michael Leigh of the German Marshall Fund, a think-tank. Larger countries delegated values-based policy to Brussels while they got on with the hard stuff, such as security or access to oil. For every pious expression of support for international justice or condemnation of capital punishment, there was a shabby energy deal or quiet support for a useful dictator. Some feel this category includes the Nord Stream 2 gas pipeline, which would run directly from Russia to Germany under the Baltic Sea and could undermine the EU’s energy policy, but which has the support of Angela Merkel, Germany’s chancellor.

Tougher than they look

Even in its soft and fuzzy days, the EU was not toothless. Its strongest tool—the attraction of membership—combined European interests and values in one package. Enlargement to the east brought stability to the region while strengthening the rule of law and democratic institutions inside candidate countries. (Maintaining them once countries have joined has proved harder, as the recent examples of Hungary and Poland demonstrate.) Globally, Europeans have, in their gentle way, sought to bolster a rules-based order that has enabled their exporters to flourish.

That looked like the future, once. But today’s threats lead down a different path. Europe’s power no longer extends outward; instead, the surrounding countries have turned their pathologies on Europe. Enlargement is off the table—even in the Balkans the EU’s main interest is in keeping order, as millions of migrants tramp through a historically unstable region. Russia’s bloody intervention in Ukraine tore up the European belief that borders may not be changed by force—and Europe initially struggled to respond. It dithered again last year as the stream of migrants coming through Greece swelled, eventually leaving Mrs Merkel with little choice but to shower gifts upon Mr Erdogan in the hope of an agreement to stanch the flow.

The Turkey deal may yet work (although Charlemagne is struggling to find anyone who believes that it will). If it cuts the number of refugees and the borderless Schengen area survives, a European ideal will have been saved. Optimists think that, even if it flops, the EU’s relations with an important neighbour will have emerged from the deep freeze. Denouncing Mr Erdogan’s power grabs through bloodless progress reports had little effect; now EU politicians can slip their concerns into exchanges on refugees, as some visiting commissioners did this week in Ankara. The crisis may also force the EU to look outward again. Tunisia, notes Jan Techau of Carnegie Europe, another think-tank, is crawling with European diplomats and money, testament to the EU’s desperation to preserve a rare success from the Arab spring.

But these are slim hopes. Europe’s vulnerabilities are on full display. Some future Qaddafi will be alert to the concessions he might win by threatening to unleash hordes of migrants upon European shores. Finland and Norway fear that Vladimir Putin may decide to do precisely that by waving through a host of Syrians and Afghans. As for Turkey, had the Europeans woken up to the coming danger last spring, they might not have found themselves compromising their values so grubbily in the autumn. That would have been the strategic thing to do. Time to dust off some of those far-sighted think-tank reports.