He won the 2010 election narrowly but fairly, and ever since has been trying to straddle the gap between Russia and the European Union.
Both Moscow and Brussels have been courting Ukraine with trade-and-aid deals, and neither one was willing to let Yanukovych have it both ways.
Yet if he opted for either one, half the country was going to condemn him, as Ukrainians are split almost 50-50 between those (mostly Ukrainian-speakers in the west of the country) who want closer ties with the European Union and those (mostly Russian-speakers in the east and south) who want stronger links with Russia. Finally, in late November, he came off the fence and chose Russia.
He did so because Russia's President Vladimir Putin was offering a huge financial bail-out if he joined Moscow's new "Eurasian Union" - and threatening to turn off the gas that keeps Ukraine's economy functioning if he did not.
He also did it because his own voters are mostly Russian-speakers in the east. But he didn't do it happily, because he knew there would be a backlash.
What he didn't reckon with is the strength and duration of the protests, and the fact that they would expand beyond the simple Brussels-or-Moscow issue to take in the widespread corruption that has flourished under his government. (Yanukovych's son Oleksandr, a dentist by training, has become one of the country's richest men in just three years.) And now his back is against the wall.
For the first two months of the confrontation, the protests were mostly peaceful, the riot police were kept on a short leash most of the time (although five people were killed), and you would have taken an even-money bet that Yanukovych could ride it out. Then he made the error of passing severe anti-protest laws. Some of the protesters, especially on the nationalist right, started to use violence, and he began to retreat.
Within a week he was repealing his new laws in Parliament, and accepting the resignation of his hard-line Prime Minister. Then he was offering the opposition leaders places in a new cabinet (they refused), and granting amnesty to protesters who faced criminal charges. Then he proposed constitutional reforms that would reduce the power of the president - but on Tuesday he postponed the debate on those reforms in Parliament.
That was when the killing started - in front of the Parliament, not on "Euromeydan", the main square that the protesters have held since late November - between the right-wing nationalists of Praviy Sektor and a pro-Government crowd imported from eastern Ukraine.
The protesters claim that the Government infiltrated agents provocateurs into their crowd to start the violence, and the police certainly fought alongside Yanukovych's supporters in the street battles there. More than a dozen people, including six police officers, were killed, but the fighting in front of Parliament was over by mid-afternoon.
It might have stopped there, but Yanukovych decided to use this calamity as an excuse to clear Euromeydan by force, although there had been no fighting there. That was when the police announced that they were starting an "anti-terror operation", and the main assault began around six in the evening.
The death toll by morning was at least 25, and the protesters still held most of the square.
Even if they subsequently lose control of the Euromeydan, they will not give up now. What is happening in Ukraine is no longer a non-violent protest against a particular Government policy. It is a revolution in which both sides are starting to see violence as legitimate, and Yanukovych's problem is that most people in the capital, though they don't approve of the violence, support the other side.
Yanukovych now has a lot of blood on his hands. If he loses this battle, he will end up in jail or in exile. Protesters are seizing control of city centres in western Ukraine, while his supporters in the east and south are not lifting a finger to help him.
And the country's most powerful oligarch (some would say king-maker), Rinat Akhmetov, has just declared that there are "no circumstances that would justify the use of force against peaceful citizens".
Yanukovych has run out of options. It is hard to see him staying in office unless he turns Ukraine into a full-scale police state, and it's not easy to see how he could make that stick.
The opposition is probably going to win. Then they'll have to figure out what they want, apart from an end to Yanukovych.