THE Soviet Union had three years left when rumbles hinting at its imminent collapse began to reverberate in the Caucasus. In 1988 leaders of Nagorno-Karabakh, a territory populated mainly by ethnic Armenians, demanded a transfer from Soviet Azerbaijan to Soviet Armenia. The Kremlin refused and a nasty war between Azeris and Armenians followed. As Thomas de Waal, an author on the Caucasus, writes, “it was the first stone in an avalanche that swept away the entire multinational construction of the Soviet Union.” Some 20,000 people died in the war and over a million became refugees. Armenia won, gaining control over seven Azerbaijani regions next to Karabakh. A ceasefire came in 1994. Pipelines sprang up to ship oil and gas from Azerbaijan. Karabakh has gained some features of a state, but is the most combustive spot in the region.

Worryingly, Azerbaijan has poured energy revenues into its army—it spends $3 billion a year (5% of GDP). It makes menacing noises about reconquest. A new war would risk Azerbaijan's petro-wealth, but irrational behaviour is all too common in the Caucasus. A renewed conflict in a region that includes Turkey, Iran, Russia and Georgia is the stuff of nightmares.

Russia's president, Dmitry Medvedev, is the latest mediator. This weekend he will sit with his counterparts, Azerbaijan's Ilham Aliev and Armenia's Serzh Sargsyan, in the Russian city of Kazan to cajole them into accepting some basic principles first drafted in 2007. The idea is that Armenia should withdraw from Azerbaijani regions outside Karabakh and that the disputed territory should win “interim status”, giving it some international legitimacy but falling short of full independence.

Mr Medvedev has invested time and effort in what will be his fifth trilateral meeting. Yet many experts who have watched these peace talks fail repeatedly remain sceptical. The two countries' semi-authoritarian leaders seem to prefer process to results and have done nothing to prepare people for peace. They may negotiate compromises in private, but they make fiery “no surrender” speeches in public.

There are doubts over Russia's motives. A benevolent explanation is that it has leverage over its ally, Armenia. Helping to resolve a complex conflict would win Mr Medvedev kudos. Grigory Shvedov, editor of Caucasian Knot, an online news agency, argues that Russia's strategic goal is to increase its political and economic influence in the Caucasus. Dominating negotiations, he says, may be more important than a solution that increases Turkey's influence.

Turkey would indeed benefit from a peace deal, but its sway over Azerbaijan is limited despite its big Azeri population. In a typical case of tail wagging dog, says Mr de Waal, Azerbaijan sabotaged moves to reopen the border between Turkey and Armenia in 2009. Yet he sees Mr Medvedev's initiative as the best chance for peace. The Armenians are signalling that they accept the draft. Azerbaijan has not rejected it but has not hinted at its agreement either.

The Americans and French, the other two mediating powers with Russia, are increasing the pressure. At the recent G8 summit in France, all three presidents stated that “further delay would only call into question the commitment of the sides to reach an agreement.” If the two leaders agree in Kazan, it will be a big step, even if it leaves room for new disputes. Were Armenia to withdraw from its “security zone”, the question arises of who would replace it. Russia may hope its role would give it an edge for providing peacekeepers, but that may not appeal after the August 2008 war in Georgia. Any notion of involving NATO troops would be fiercely resisted by Russia and Iran. One thing is certain: making peace in Nagorno-Karabakh requires the skill of walking over a minefield.