LOOK on and despair. A decade ago Thailand was a shining example—rare proof that in South-East Asia a vibrant democracy could go hand-in-hand with a thriving economy. Contrast that with Thailand on May 7th, left in disarray after the Constitutional Court demanded that the prime minister, Yingluck Shinawatra (pictured), step down with nine members of her cabinet over her decision to remove the country’s head of national security in 2011, in favour of a relative.

For all the pretence of due legal process and distaste at Ms Yingluck’s nepotism, this was not an offence that merited the ousting of a prime minister. Instead, the ruling is a measure of quite how far Thailand has fallen, how deeply it is divided and how badly its institutions are broken (see article). Unless Thais step back from the brink, their country risks falling into chaos and anarchy, or outright violence.

In kicking out Ms Yingluck, the court accomplished what months of anti-government street protests in Bangkok, led by a firebrand populist, Suthep Thaugsuban, had failed to bring about. It is far from the first time the court has ruled against her. To break the impasse on Bangkok’s streets, she had called a February election, but the opposition Democrat Party boycotted it, and the court struck down the results. Ms Yingluck had been limping on as a caretaker. The message for many Thais is that the court is on the side of a royalist establishment bent on purging politics of Ms Yingluck, who came to office three years ago in a landslide election, and—especially—her brother, Thaksin Shinawatra, himself ousted in a coup in 2006 and now in self-imposed exile.

The entire apparatus of government has been sucked into the conflict between two visions of Thailand. For Mr Thaksin’s supporters, his emergence in 2001 marked a welcome break from decades of rule by corrupt coalitions or military juntas. Helped by a new democratic constitution in 1997, he gave a voice to Thailand’s majority, many of them in his northern and north-eastern heartland. In their view, he transformed the lives of the poorest with health and education programmes, and he challenged Thailand’s privileged elites in the bureaucracy, the army, the judiciary and the palace corridors of an ailing King Bhumibol Adulyadej. To the Thaksinites, both the recent street protests and the Constitutional Court’s activism are the work of an establishment that cannot accept the results of the ballot box: in 2001, 2005, 2006, 2007 and 2011 parties loyal to Mr Thaksin won elections fair and square, and Ms Yingluck’s Pheu Thai party would have done so, too, in February.

There is merit in this interpretation. But so is there in what the Shinawatras’ enemies have to say. In particular, they charge that Thaksinite governments have been run for the benefit of his rural supporters (a mad scheme to subsidise rice threatens to bust the budget) and of the billionaire himself. There is something creepy about the way that the exiled, unelected Mr Thaksin has been calling the shots from Dubai.

Now stalemate beckons. An election is supposed to happen. Ms Yingluck should have had the right to confront her undemocratic royalist foes at the ballot box. But an election is no solution because the opposition will boycott it. Mr Suthep has proposed a “people’s council” of the great and the good, but Thaksinites will rightly see it as a stitch-up designed to keep them out. The irreconcilable differences between the two sides have swallowed up Thailand’s courts, its army and even the monarchy—and left Thailand at the abyss. Investors, having borne years of simmering discontent, are taking fright. Blood has already been spilled this year. The prospects of wider violence are growing as Thaksinite supporters threaten conflict on the streets.

Stop and think

If Thailand is to avoid that catastrophe, both sides must now step back from the brink. The starting point is the devolution of Thailand’s highly centralised system of governance. At the moment only the capital has a democratically elected governor, yet all 76 provinces should also have one—this would not only help a rumbling Muslim insurgency in the south, it would also offer a prize to Mr Suthep, because the winner of the national election would no longer win all the power. In return for this reform, the Democrat Party must pledge to accept election results; and in return for that, the Pheu Thai should run without a Shinawatra at the helm.

Goodwill is in short supply in Thailand today. Yet by fighting on, the two sides risk bringing ruination to their country. Compromise would, by comparison, be a small price to pay.