VLADIMIR PUTIN, Russia’s president, deserves the highest medal of Ukraine. He has done more for its European integration in the past few months than any Ukrainian politician has over the past 20 years. He has stopped the country’s directionless drift, consolidated its elite, given it an impetus westward and mobilised European politicians. Never before has Ukraine been so close to signing an association and free-trade agreement with the European Union, a step towards EU membership. At the recent Yalta European Strategy conference, held in the Livadia palace, where Churchill, Roosevelt and Stalin carved up the map of Europe nearly 70 years ago, geopolitics unfolded in real time and Ukraine was right in the middle of it. “Ukraine is on the final lap, and it must double its efforts and finish off the job…we’ve done it, so can you,” said Radek Sikorski, Poland’s foreign minister.

The presence of European and American heavyweights, such as Bill and Hillary Clinton, contrasted with the absence of Russian diplomats. The Kremlin was represented by Sergei Glaziev, a nationalist-minded economic adviser to Mr Putin, whose deliberately provocative speech consisted of thinly veiled insults to Ukraine and a warning to Europe: does it really want to take on a nearly bankrupt country? It was a perfect illustration of the Kremlin’s “soft power”, designed to push Ukraine into the Russia-led Eurasian customs union, in fact achieving the opposite.

The Kremlin’s tactics smacked of desperation. Until recently it had assumed that so long as Yulia Tymoshenko, a former Ukrainian prime minister, was in jail, the EU would not sign an agreement with her jailer, Viktor Yanukovych, Ukraine’s president. But a few months ago, Mr Putin is said to have received an intelligence report saying that Mrs Tymoshenko may no longer be a safe obstacle to rely on.

A purported Kremlin plan proposed “putting pressure from all sides, creating a sense of inevitability for joining the [customs] union as a way of survival for the ruling elite”. Whether the plan was real or not, it led to actions: Ukrainian chocolates made by Petro Poroshenko, a former minister, were banned on “health and safety grounds”. Import of Ukrainian pipes made by Viktor Pinchuk, another oligarch, were disrupted. The oligarchs didn’t waver.

The hitherto disparate and squabbling Ukrainian elite has united behind the president. The opposition agreed to back Mr Yanukovych in parliament to pass the legislation demanded by the EU as a precondition for signing the agreement, including judicial reform. None of these laws has much bearing on Ukrainian reality.

Mr Yanukovych has not undergone a sudden conversion to European values of democracy and fair play. Like most of Ukraine’s political class, he is driven by short-term interests and seems to care more for his own power and wealth than for the country’s future. But that does not make his reasons for wanting an association agreement with Europe any less real.

The country’s economy is teetering on the brink of bankruptcy—largely a result of corruption and a lack of reform—and a presidential election looms in 2015. Mr Yanukovych needs either Russian money (which comes with the price tag of joining the customs union) or an association agreement with the EU, which could clear the way for disbursement of money from the IMF. An agreement with the EU seems the lesser of two evils.

“Mr Yanukovych does not want to share his hunting ground—which is the whole of Ukraine—with his northern neighbour,” says Yulia Mostovaya, editor of Zerkalo Nedeli, an influential weekly. It is also a matter of pride. As a top dog whose governance style is close to that of a clan chief, Mr Yanukovych is particularly allergic to continual signs of contempt coming from Mr Putin, who considers him a renegade and a provincial redneck.

Ukrainian oligarchs also have their reasons for backing Ukraine’s European integration. They see it not only as protection against being swallowed by larger Russian businesses, but, more importantly, as protection against Mr Yanukovych himself. Having made their fortunes in the chaotic and lawless privatisation of the 1990s, they are now looking for the rule of law and property rights. The potential loss of the Russian market could hit them hard, but it would also give them an impetus to modernise their businesses.

Yet there is also no guarantee that the association agreement will actually be signed next month. Mr Yanukovych does not like to act under pressure and he seems to have an almost irrational fear of Mrs Tymoshenko. There is a risk that he is under the illusion that demands for Mrs Tymoshenko’s release are just lip service to human rights and that the deal will be signed by the EU no matter what.

The situation is not helped by differences among EU members. For Sweden and particularly for Poland, whose future was decided in Yalta in 1945, drawing Ukraine away from Russia’s sphere of influence and into that of the EU is of existential importance. France and Spain, on the other hand, may be quietly pleased to see the deal fall through. As so often, the final decision will rest with Germany’s Angela Merkel. Yet nobody needs an association agreement as much as Ukrainians themselves. As Ms Mostovaya says, a country with a soft skeleton needs a hard external shell to survive.