AP

GORI was Stalin's birthplace. Did his statue in Stalin Square smile approvingly on Vladimir Putin as Russian tanks rolled past and the few residents left wandered around the bombed ghost town, without purpose? In 1921 the Bolsheviks occupied Georgia. Now Russia, for the first time since the collapse of the Soviet Union, had invaded a sovereign country.

Georgia was once the jewel of its empire, and Russia has never psychologically accepted it as a sovereign state. Nostalgia for the Soviet empire has long been the leitmotif of Russia's ideology. This month it re-enacted its fantasy with aircraft and ground troops. It occupied Abkhazia and South Ossetia, the two separatist regions of Georgia, blockaded the vital port of Poti, sank Georgian vessels, destroyed some infrastructure, blocked the main east-west highway and bombed and partially occupied towns in Georgia, including Gori.

Western diplomats and politicians rushed to Moscow and to Georgia's capital, Tbilisi, trying to broker a ceasefire. The lobby of Tbilisi's main hotel resembled a United Nations conference. On August 12th Russia, having pulverised the small Georgian army, decided it was time to stop. A few hours before France's president, Nicolas Sarkozy, was due in Moscow, Russia's president, Dmitry Medvedev, announced an end to Russia's “peace enforcement operation”. The aggressor, he said “is punished and its military forces are unravelled”. He then signed the ceasefire plan that Mr Sarkozy brought to Moscow.

That same day, hundreds of thousands of Georgians flooded Rustaveli Avenue, Tbilisi's main street. They read poetry and sang songs. Georgia, a small, dignified, theatrical nation, had held together. In the evening they lit candles and waved flags: Georgian, Ukrainian, Armenian. On the same spot almost 20 years ago Soviet troops had brutally disbanded a demonstration which had declared Georgia's independence.

Yet it was not until America's George Bush delivered a stark warning to Russia late on August 13th that Russia began to pull back all its forces. Mr Bush sent his secretary of state, Condoleezza Rice, to Georgia and told his defence secretary, Robert Gates, to organise a humanitarian-aid operation. The first American aircraft landed at Tbilisi airport soon afterwards.

So what was all this about? Clearly, more than the two separatist regions of Abkhazia and South Ossetia, as Russia claimed. It was also about more than simply punishing Georgia for its aspirations to join NATO, or even trying to displace Mikheil Saakashvili, Georgia's hot-headed president, who has irritated Russia ever since he came to power in the “rose revolution” in 2003. It is about Russia, resurgent and nationalistic, pushing its way back into the Caucasus and chasing others out, and reversing the losses Russia feels it has suffered since the end of the cold war.

The fact that Georgia is backed by the West made it a particularly appealing target. In fighting Georgia, Russia fought a proxy war with the West—especially with America (which had upgraded the Georgian army). All this was a payback for the humiliation that Russia suffered in the 1990s, and its answer to NATO's bombing of Belgrade in 1999 and to America's invasion of Iraq. “If you can do it, so can we,” was the logic.

Russia was also drawing a thick red line on the map of Europe which the West and NATO should not cross. And, as in any war, there were powerful subjective reasons in play. Mr Putin's personal hatred of Mr Saakashvili, and his ability to deploy the entire Russian army to fulfil his vendetta, made war all but inevitable.

With the smoke of battle still in the air, it is impossible to say who actually started it. But, given the scale and promptness of Russia's response, the script must have been written in Moscow.

Who is to blame?

The rattling of sabres has been heard in both capitals for months, if not years. Russia imposed sanctions on Georgia and rounded up Georgians in Moscow. In revenge for the recognition of Kosovo's independence earlier this year, Mr Putin established legal ties with the governments of South Ossetia and Abkhazia. When Mr Saakashvili called Mr Putin to complain and point out that the West supported Georgian integrity, Mr Putin, who favours earthy language, is said to have told him to stick Western statements up his backside.

In the late spring, Russia and Georgia came close to a clash over Abkhazia but diplomats pulled the two sides apart. A war in Georgia became a favourite subject in Moscow's rumour mill. There were bomb explosions in Abkhazia and the nearby Russian town of Sochi, the venue of the 2014 Winter Olympics.

Suddenly, the action switched to South Ossetia, a much smaller rebellious region divided from Russia by the Caucasus mountains. In early July Russia staged a massive military exercise on the border with South Ossetia. At the same time Russian jets flew over the region “to establish the situation” and “cool down Georgia's hot-heads”, according to the Russians.

The change of scene should not, in retrospect, be surprising. Unlike Abkhazia, which is separated from the rest of Georgia by a buffer zone, South Ossetia is a tiny patchwork of villages—Georgian and South Ossetian—which was much easier to drag into a war. It is headed by a thuggish former Soviet official, Eduard Kokoity, and run by the Russian security services. It lives off smuggling and Russian money. As Yulia Latynina, a Russian journalist, puts it, “South Ossetia is a joint venture between KGB generals and an Ossetian gangster, who jointly utilise the money disbursed by Moscow for fighting with Georgia.”

In early August Georgian and South Ossetian separatists exchanged fire and explosive attacks. South Ossetia blew up a truck carrying Georgian policemen and attacked Georgian villages; Georgia fired back at the capital of South Ossetia, Tskhinvali. On August 7th Georgian and South Ossetian officials were due to have direct talks facilitated by a Russian diplomat. But according to Temur Iakobashvili, a Georgian minister, the Russian diplomat never turned up.

What happened next is less clear. Russia claims that Mr Saakashvili treacherously broke a unilateral ceasefire he had just announced, ordering a massive offensive on Tskhinvali, ethnically cleansing South Ossetian villages and killing as many as 2,000 people. According to the Georgians, the ceasefire was broken from the South Ossetian side. However, what triggered the Georgian response, says Mr Saakashvili, was the movement of Russian troops through the Roki tunnel that connects South Ossetia to Russia. Matthew Bryza, an official at the State Department, says he was woken at 2am on August 7th to be told that the Georgians were lifting the ceasefire. “I tried to persuade them not to do it,” he says.

That same night, Georgia started to shell and invade Tskhinvali. Then the Russian army moved in—the same troops that had taken part in the military exercise a month earlier. The picture Russia presented to the world seemed clear: Georgia was a reckless and dangerous aggressor and Russia had an obligation, as a peacekeeper in the region, to protect the victims.

Russia's response was predictable. One thing which almost all observers agree on is that Mr Saakashvili made a catastrophic mistake by walking into the Russian trap. As Carl Bildt, Sweden's foreign minister, puts it: “When you have a choice between doing nothing and doing a stupid thing, it is better to do nothing.” But Mr Saakashvili, a compulsive risk-taker, did the second. Even now he is defiant: if the clock were turned back, he says his response would be the same. “Any Georgian government that would have done differently would have fallen immediately,” he says.

Mr Saakashvili bears responsibility for mismanaging disputes between Georgia and the enclaves, pushing them firmly into Russian hands. Yet his mistakes and follies notwithstanding, Russia's claim that it was “enforcing peace” is preposterous. Despite the terrible atrocities which both South Ossetia and Abkhazia suffered in the early 1990s from the brutal and nationalist government of the Georgian president, Zviad Gamsakhurdia, South Ossetians got on with the Georgians much better than the Abkhaz did. They traded heavily in a smugglers' market (which Mr Saakashvili shut down in 2004) and lived alongside each other peaceably.

“Georgians always helped me and I don't feel any pressure now,” says a South Ossetian woman who got trapped in Gori after the Russian attack. This is not a comment frequently heard in Abkhazia. Mr Saakashvili's nationalistic approach to separatist conflicts certainly did not help, but had it not been for Russia supporting South Ossetia's corrupt regime, the two sides would not have gone to war. And instead of containing the conflict Russia deliberately spread it to Abkhazia.

Tales of horror

Russia was prepared for the war not only militarily, but also ideologically. Its campaign was crude but effective. While its forces were dropping bombs on Georgia, the Kremlin bombarded its own population with an astonishing, even by Soviet standards, propaganda campaign. One Russian deputy reflected the mood: “Today, it is quite obvious who the parties in the conflict are. They are the US, UK, Israel who participated in training the Georgian army, Ukraine who supplied it with weapons. We are facing a situation where there is a NATO aggression against us.”

In blue jeans and a sports jacket, Mr Putin, cast as the hero of the war, flew to the Russian side of the Caucasus mountain range to hear, first-hand, hair-raising stories from refugees that ranged from burning young girls alive to stabbing babies and running tanks over old women and children. These stories were whipped up into anti-Georgian and anti-Western hysteria. Russian politicians compared Mr Saakashvili to Saddam Hussein and Hitler and demanded that he face an international tribunal. What Russia was doing, it seemed, was no different from what the West had done in its “humanitarian” interventions.

There was one difference, however. Russia was dealing with a crisis that it had deliberately created. Its biggest justification for military intervention was that it was formally protecting its own citizens. Soon after Mr Putin's arrival in the Kremlin in 2000, Russia started to hand out passports to Abkhaz and South Ossetians, while also claiming the role of a neutral peacekeeper in the region. When the fighting broke out between Georgia and South Ossetia, Russia, which had killed tens of thousands of its own citizens in Chechnya, argued that it had to defend its nationals.

But as Mr Bildt argues, “we have reason to remember how Hitler used this very doctrine little more than half a century ago to undermine and attack substantial parts of central Europe.” In the process of portraying Georgia as a fascist-led country, Russia was displaying the syndrome it was condemning. And it did not seem to mind when, as Human Rights Watch (HRW) reports, ethnic Georgian villages were looted and set on fire by South Ossetian militia. “The remaining residents of these villages are facing desperate conditions, with no means of survival, no help, no protection, and nowhere to go,” says Tanya Lokshina of HRW.

The biggest victims of this war are civilians in South Ossetia and Georgia. Militarily, Mr Putin has won, hardly surprisingly. But all Russia has got from its victory so far is a ruined reputation, broken ties with Georgia, control over separatist enclaves (which it had anyway) and fear from other former Soviet republics. Mr Saakashvili, who promised to reintegrate the country when he was elected president, has made this prospect all but unattainable.

The six-point peace plan negotiated by Mr Sarkozy recognises Georgian sovereignty but not its integrity. In practice, this means that Russia will not allow Georgia back into Abkhazia and South Ossetia. According to the same plan, Russia should withdraw its troops to where they were before the war broke out.

So what happens now?

The ceasefire is signed, but it still needs to be implemented. The early signs were not good with looting, killing and rapes in villages in both Georgia and South Ossetia. On August 13th the Americans announced that they would send military aircraft and naval forces to deliver humanitarian aid to the Georgians. This seemed to make more impression on the Russians, who soon began to withdraw, than the agreement in principle by the European Union to send monitors to supervise the ceasefire. A NATO meeting has also been called to reassess relations with Russia.

Much will now depend on how far Russia wants to go and whether it wants Mr Saakashvili's head on a plate or not. In a confidential conversation with Condoleezza Rice, America's secretary of state, Sergei Lavrov, Russia's foreign minister, declared that Mr Saakashvili should go. The conversation was made public at the UN Security Council, infuriating the Russians. Regime change is a Western invention, Russia retorted; Russia will not try to overthrow Mr Saakashvili, but will simply refuse to deal with him.

Other former Soviet republics, including Azerbaijan, Armenia, and Ukraine, have been dealt a lesson, about both Russia's capacity to exert its influence and the weakness of Western commitments. America's inability to stop or deter Russia from attacking its smaller neighbours has been devastatingly obvious in Georgia over the past week.

Yet the people who are likely in the end to pay the biggest price for the attack on Georgia are the Russians. This price will go well beyond any sanctions America or the European Union could impose. Like any foreign aggression, it will lead to further stifling of civil freedoms in Russia.

The war in Georgia has demonstrated convincingly who is in charge in Russia. Just as the war in Chechnya helped Mr Putin's rise to power in 1999, the war in Georgia may now keep him in power for years to come. As Lilia Shevtsova of the Carnegie Moscow Centre argues, if Mr Medvedev still had a chance to preside over a period of liberalisation of Russia, this opportunity is now gone. The war in Georgia will make Russia more isolated. Worst of all, it will further corrode the already weak moral fabric of Russian society, making it more aggressive and nationalistic. The country has been heading in the direction of an authoritarian, nationalistic, corporatist state for some time. The war with Georgia could tip it over the edge.