WHEN the European Union expanded to take in eight former Communist countries, leaders faced a conundrum: they did not want to keep extending the club eastward, neither did they want to tell Ukraine and others that they would be shut out forever. So they devised a middle way: the EU would offer to extend large parts of its single market to countries in eastern Europe, the Caucasus and the Mediterranean rim, without making any promises of membership.

This European Neighbourhood Policy was meant to create “a ring of friends”. Ten years on, Europe's borderlands look more like a ring of fire. Libya has been in violent chaos since the overthrow of Muammar Qaddafi. In Egypt one military ruler was replaced by another after a brief interlude with an elected president. Syria is suffering an appalling civil war. Georgia has lost territory after a war with Russia. Belarus languishes under the dictatorial Alexander Lukashenko. Two small countries, Tunisia and Moldova, are the closest thing to success.

For a time it looked as if Ukraine would join the list of failures. Last November, ahead of a summit in Vilnius of the EU and ex-Soviet countries, President Viktor Yanukovych caved in to Russia and refused to sign an association agreement with the EU that included a “deep and comprehensive” free-trade deal. This was a pyrrhic victory for Russia. Pro-European protesters took to the streets of Kiev and, after weeks of confrontation that culminated with the shooting of protesters, Mr Yanukovych ran away.

Opinions around Europe are divided about the meaning of events in Kiev. A recent paper by Stefan Lehne, a former Austrian diplomat, argues that the neighbourhood policy has failed. Modelled on the enlargement process, it “does not work for countries that do not want close association with the EU, and the absence of the carrot of future membership frustrates those who do”, writes Mr Lehne in his paper for Carnegie Europe, a think-tank. The slow process of enacting European standards, on everything from the environment to food safety, was designed for a stable world, not tumultuous revolutionary change. Others, though, are convinced that the victory of Ukraine’s Maidan protesters is proof that Europe's soft power can still trump Russian bullying.

Ukraine presents the EU with an opportunity to redeem itself. The foreign ministers of Poland, Germany and France were in Kiev at the height of the shooting, and may have facilitated a controlled collapse of Mr Yanukovych's rule. The EU's foreign-policy chief, Cathy Ashton, was in Kiev this week to urge victorious anti-Yanukovych parties to create an “inclusive” government and avoid witch-hunts. The visitors come away with a strong sense that they must not let down those who risked their lives. But as Mr Lehne argues, their tools may be too limited.

The EU decided far too late to impose sanctions on Mr Yanukovych's regime. The deal it offered Ukraine involved long-term modernisation and a pledge to support an IMF-sponsored adjustment programme. It said it would not be drawn into a bidding war with Russia, which instead offered a large instant loan and cheaper gas. Now Europeans are scrambling to come up with a short-term financial package to halt an imminent default. They are still hoping that Russia might contribute. They are also planning to send technical experts to help Ukraine manage reforms and ensure the money is not stolen. Andrew Wilson of the European Council on Foreign Relations, a think-tank, has proposed a longer to-do list. It includes help to recover stolen assets stashed away in Europe, limited interim trade-agreements to help kick-start the economy, inclusion of “civil society” in political reforms and facilitating EU visas for Ukrainians.

Soon the Europeans will have to decide whether to go ahead with the accord that Mr Yanukovych rejected. Most think they should wait until Ukraine holds presidential elections, changes the constitution and then holds a ballot for the new parliament. The current crop of opposition leaders taking over power in Kiev, not least Yulia Tymoshenko, the former prime minister, are viewed with suspicion by many Maidan protesters. EU officials also worry about provoking Russia in its already resentful mood.

In fact, the timing will be decided by Ukrainians themselves. Having been prepared to deal with a man who now has much blood on his hands, and having promised Ukrainians that the accord remains on the table, the EU can hardly refuse if the interim government asks to sign it.

Back to the future

The signature ceremony would be a good time to answer the question Europeans have tried to avoid for a decade: should they offer a “membership perspective” to Ukraine? Earlier this month EU foreign ministers dropped a cryptic hint in a statement, saying that the association agreement “does not constitute the final goal in EU-Ukraine co-operation”. They should be more explicit and say that a future democratic Ukraine would be eligible to apply, even though the prospect is far off.

The Europeans should also rethink the neighbourhood policy, which lumps together disparate countries merely because they happen to be nearby. In the south it may have to devise a wider concept of its interests stretching out to the Sahel, the Horn of Africa and the Middle East. Here Europe has no real friends, lots of acquaintances and not a few enemies. To the east it needs better ways of helping those who want to move closer to the EU.

Above all, the EU needs a coherent policy to deal with Russia. Its members are divided between Russo-sceptics, particularly in the Baltic states and Sweden, and Russophiles including Cyprus, Italy and Hungary. Russia's behaviour in Ukraine should be a warning to all Europeans of the danger of embracing Vladimir Putin closely.

Economist.com/blogs/charlemagne