In a world where rulers with authoritarian and nationalist instincts have been steadily curbing political freedoms, the election of a multiracial reformist coalition in Malaysia two years ago was a heartening victory for democracy.

Voters in 2018 threw out the United Malays National Organisation (Umno), which had run Malaysia for 61 years and had, under prime minister Najib Razak, become a venal operation that stayed in power by stirring communal tensions and locking up critics.

Unfortunately, Umno is now on the brink of returning to office thanks to a royal coup enabled by hubris and infighting.

At the heart of the story is the distrust between Dr Mahathir Mohamad, the 94-year-old founding father of modern Malaysia, and his political rival and presumed successor, Anwar Ibrahim.

These were the dominant figures of the Pakatan Harapan, the unwieldy coalition that had won the shock electoral victory in 2018.

They fell out during a power struggle 20 years ago when Mahathir was prime minister and Anwar his deputy. That episode ended badly for Anwar who went to prison on sodomy charges when his only offence was allegedly being charismatic and intelligent.

Yet by 2018 they were reunited as political allies and defeated a kleptocratic government. Mahathir became prime minister and Anwar returned to parliament.

The doubts and suspicions between the two men saw them struggle to introduce reforms and the economy sputtered. Old power brokers remained in place, biding their time until there was an opportunity to strike.

That moment arose last month when Mahathir seemed to think he was being undermined and abruptly resigned. Yet the threat within was not from Anwar, but rather Dr Mahathir’s deputy, Muhyiddin Yassin, who decided to walk out on his boss and leave the ruling coalition.

Mahathir had badly miscalculated in believing only he could hold the government together and would thereby be reappointed by the king, or Agong.

In the event, the monarch passed over Mahathir and appointed the newly independent Muhyiddin as prime minister, citing his ability to command a parliamentary majority.

Umno is the biggest party in Muhyiddin’s putative coalition. There are well-grounded fears that if Muhyiddin ends up in charge Najib will pull the strings. This is at a time when Najib is on trial for corruption charges and his aim will be to get off the hook.

Muhyiddin ought to be forced to test his claim of a majority. If he does not, then Mahathir and Anwar, who say they have the votes needed for a majority, must be given a chance to form the government.

The mood music suggests the Agong could instead prorogue parliament – or even dissolve it and call fresh elections. This would be a mistake, creating a vacuum for nationalist or religious demagogues to fill.

A king has overturned a democratic election result that challenged a corrupt old order. This is wrong and the world ought to call it out.

THE GUARDIAN