If Viktor Yanukovych is as good as his word, dozens have died needlessly on the streets of Kiev.

Ukraine's president could have agreed to elections days and weeks ago. His country could have been spared death, grief and divisions that will take years to heal. Finally, he acts.

But then, there are no actors free of culpability in this tragedy. Protesters might regard Mr Yanukovych as a corrupt, authoritarian oligarch exploiting the police to cling to power. They might have an abundance of evidence on their side. They might allege that his election in 2009 was due to vote-rigging. Outside observers and opinion polls taken at the time disagree. Whatever his behaviour in office, Mr Yanukovych was duly elected.

If anything, Ukraine has provided depressing evidence for the belief that popular uprisings in the modern style are not always as simple or as thrilling as they might seem. Occupying the main square of a capital and issuing demands might have a certain romantic appeal, but it can also have unintended consequences. Egypt's revolution has ended in a military coup. Thailand's unrest has led to the weird spectacle of protesters rejecting democratic elections. In Ukraine, the demand for closer links with the European Union has led, step by step, to bloodshed.

Things are more complicated than that sentence might suggest, of course. For the Kiev demonstrators the EU is symbolic of the rule of law, of oligarchs brought to book, and of an end to their country's centuries-old domination by Russia. But in fewer than 23 years as an independent state Ukraine has achieved little more than a series of "revolutions" that have succeeded only in dividing the country. This is not how the West likes to view matters.

The idea that all virtue resides with protesters while all the bad guys side with Mr Yanukovych and Russia's Vladimir Putin is simplistic, at best. For one thing, there are numerous credible reports of extreme right-wingers - fascists, in common language - joining the ranks of the demonstrators and instigating violence against state security forces. Since the latter have a long record of thuggishness, that might cause few qualms among some of those who want the president out. It demonstrates, though, that the issues are complex and that, in parts, the attempted revolution is tainted.

Has the EU grasped as much? If so, it has taken its sweet time to come to an understanding. Ukraine, strangely enough, has not seen its aspirations to join the union dismissed over the years as "extremely difficult, if not impossible" by Jose Manuel Barroso, president of the European Commission. Quite the opposite.

Instead, the EU has been playing high-stakes poker over the future of a country whose instability is now obvious. Expansionism embracing still another east European country has had catastrophic consequences thanks to inept diplomacy from Mr Barroso and his colleagues. The threats of a few sanctions or the brokering of a truce to halt the violence in Kiev do not conceal the fact that the EU has not enjoyed its finest hours. A confident but simplistic belief in Western virtue has been rewarded with chaos.

Perhaps the union's self-regard was inevitable. After all, how could anyone fail to prefer integration with the democratic EU to the tender mercies of Mr Putin? Disconcertingly for the likes of Mr Barroso, the answer is that a substantial number of Ukrainians, predominantly Russian speakers, do not regard Mr Yanukovych as utterly illegitimate and do not disdain old ties and an ancient heritage. Drawing them into the EU's sphere of influence was never likely to be simple. Russia's president would see that.

Mr Putin might be an all-purpose villain for Western governments, but his attitudes are easy enough to discern. Above all, he is a Russian nationalist, one of those who still locates his country's Slavic origins in the Kievan Rus, and one who still views geopolitics in terms of Russia's old struggle against perceived encirclement. Ukraine might be the EU's neighbour, but for Mr Putin it is much more. He was never going to allow it to be detached without an argument. His notion of necessary influence runs deep.

Before the violence in Kiev began to resemble a civil war, both Russia and the EU put offers on Mr Yanukovych's table. The western Europeans had prepared an "accord" that continued a long process of integration and enticement, with EU membership as its logical conclusion. With Ukraine struggling economically - a factor too often overlooked - Mr Putin waved £11 billion under the noses of a regime never averse to money. Last November, the EU accord was left unsigned and the protests became serious.

Reasonably enough, sympathy here is extended to those risking their lives for establish the rule of law. Mr Putin's Russia is hardly the model for any aspirant democracy. But to depict the events in Ukraine as another example of a people struggling against tyranny and corruption is to offer only a half truth. The talk this week of civil war has arisen for the obvious reason that the country is divided. With the protesters themselves falling into several camps, elections alone might not be enough to resolve the problem.

Still, better to vote than to destroy the country. If Mr Yanukovych has a gift for ballot-stuffing he will have to exercise his talents under close scrutiny before the year is out. With the endorsement of the protesters, the former boxer Vitali Klitschko and other opposition leaders have, so it seems, accepted the offer of elections and a "unity government". Reportedly, EU ministers from Germany and Poland have forced their truce, arguing that the alternative is martial law.

What happens, though, if those who side with Mr Yanukovych prevail in the promised elections? That's not impossible. Russian-speaking eastern Ukraine could yet take the Putin view of alleged EU machinations. Paranoid answers might emerge from those citizens, but their questions will remain valid. Then what?

EU expansionism in the east has been depicted as a benign process by which formerly tyrannised states embark on peaceful journeys to democracy. If the language is to your taste, these people rejoin the European family. Mr Barroso and his ilk are on hand - but let's not labour the ironies - to welcome them home. The ugliness of events in Ukraine, the unanswered questions over legitimacy and popular protest, say this pretty picture is distorted. And they lead to further questions.

What are the EU's ambitions, exactly? There are five candidates - Iceland, Macedonia, Montenegro, Serbia and Turkey - for future membership. Albania would like to join the queue but has yet to be recognised. Bosnia and Herzegovina, along with Kosovo - Mr Barroso's favourite unlikely example - have been talked of as potential candidates. Ukraine is meanwhile one of the EU's "Eastern Partnership" states, along with Armenia, Belarus, Georgia, Azerbaijan and Moldova. This is a full-blown foreign policy agenda.

Neither Mr Barroso nor any of his colleagues can say where this leads, or why. The mess in Ukraine says those famous seamless transitions to EU membership are more easily achieved in some places than in others. When your best hope is for the killing to stop, democracy has a long way to go.