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 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 Dr Mahathir was prime minister and Mr Anwar his deputy. That episode ended badly for Mr Anwar who went to prison on trumped-up sodomy charges, when his only offence was being charismatic and intelligent. Yet by 2018 they were reunited as political allies and defeated a kleptocratic government. Mr Mahathir became prime minister and Mr Anwar returned to parliament.

The doubts and suspicions between the two men saw them struggle to introduce reforms and the economy spluttered. Old power brokers remained in place, biding their time until there was an opportunity to strike. That moment arose last month, when Dr Mahathir seemed to think he was being undermined and abruptly resigned. Yet the threat within was not from Mr Anwar, but rather Dr Mahathir’s deputy, Muhyiddin Yassin, who decided to walk out on his boss and leave the ruling coalition. Dr 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 Dr Mahathir and decided to appoint the newly independent Mr Muhyiddin as prime minister, citing his ability to command a parliamentary majority.

UMNO is the biggest party in Mr Muhyiddin’s putative coalition. There are well-grounded fears that if Mr Muhyiddin ends up in charge Mr Najib will pull the strings. This is at a time when Mr Najib is on trial for corruption charges and his aim will be to get off the hook. Mr Muhyiddin ought to be forced to test his claim of a majority. If he does not then Dr Mahathir and Mr Anwar, who say they have the 112 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 democractic election result that challenged a corrupt old order. This is wrong and the world ought to call it out.