The world’s oldest national leader, Mahathir Mohamad, submitted his resignation Monday as prime minister of Malaysia, triggering the collapse of his government.

Instead of taking him out of power, the move paved the way for 94-year-old Mahathir, who ruled Malaysia for more than two decades until 2003 before his second stint at the job began in 2018, to once again act as a political kingmaker, as his ruling coalition crumbles under the weight of decades-old feuds, rivalries and elite backdoor politics.

Central to that feud are Mahathir and Anwar Ibrahim, the elder statesman’s 72-year-old ­protege turned rival turned ally. Anwar was ousted in the 1990s when he was Mahathir’s deputy, jailed on sodomy charges that his supporters called fabricated and banished from the ruling elite. But in a rapprochement, the two men joined forces ahead of 2018 elections, leading a new movement that ousted a coalition that had ruled for six decades.

Mahathir pledged as part of their agreement that he would eventually hand power to Anwar, but it took just a few months after the 2018 vote for their political marriage of convenience to begin looking shaky.

The murky political drama, which was playing out without much transparency on Monday, undercut what had been one of the region’s more promising political transitions and harked back to a time when backdoor dealing and palace intrigue were the keys to Malaysia’s levers of power.

“There are perceptions that this undermines the democratic process and undermines the kind of mandate that people put into the new government,” said Bridget Welsh, an honorary research associate at the University of ­Nottingham Malaysia’s Asia Research Institute who has studied the country’s politics. “There is a lot of disappointment among people who voted for the ­[Mahathir-Anwar coalition] to see the government collapse as it has.”

A statement from the prime minister’s office said Mahathir submitted his resignation to Malaysia’s king. Under Malaysia’s constitution, the entire cabinet must be dissolved if the prime minister resigns.

At the same time, Mahathir’s party, the Malaysian United Indigenous Party, known as Bersatu, said it would leave the ruling coalition. Mahathir also quit as the party’s leader, and about a dozen other prominent lawmakers left to form an independent bloc in the legislature — paving the way for a complete reconfiguration of the Southeast Asian country’s government.

Experts said the most remarkable characteristic of the upheaval is that all political blocs, the opposition and the ruling coalition alike, are appealing for Mahathir to stay in power, giving him the opportunity to realign the political status quo and potentially sideline Anwar with a broad base of support.

“This will give [Mahathir] maximum flexibility; he can start everything on a clean new slate,” said James Chin, director of the Asia Institute Tasmania at the University of Tasmania. “He holds all the cards.”

The king, Sultan Abdullah of Pahang, has not commented publicly on the matter. Analysts say that Abdullah could call for fresh national elections, declare a state of emergency, negotiate with Mahathir to form a new government if he has a majority of lawmakers behind him, or call for an emergency session of the legislature to resolve the issue.

Both Mahathir and Anwar met Monday night with the king, who said he would accept the elder statesman’s resignation but wanted him to stay on as interim prime minister. Cabinet members were also relieved of their duties.

A spokesman for Anwar did not respond to a request for comment.

In landmark elections in May 2018, Malaysians ousted a long-serving coalition government whose leader, Najib Razak, was dogged by a multibillion-dollar corruption scandal. The vote ushered in a new coalition — Pakatan Harapan, or the Alliance of Hope — led by Mahathir and Anwar.

Mahathir had promised to cede power to his former rival during his term, but he remained vague on the timeline. Months after the vote, in an interview with The Washington Post, Anwar groused that Mahathir and his supporters were working on the sidelines to stymie his leadership prospects. Throughout the past year, Anwar had been working to assure Malaysians that the two were finally able to get along, posting pictures on social media of their meetings and saying that he believed Mahathir was sincere about handing over the reins.

But the behind-the-scenes hostilities exploded into full view over the weekend, when Anwar said Mahathir’s party and “traitors” within his own party were plotting behind the scenes to effectively form a new government and sideline him.

Malaysia’s ruling coalition was especially celebrated for being able to draw together liberal parties and conservatives across racial and religious lines. Hopes were high that the bloc’s electoral success could usher in a new era of inclusive politics in which minorities, including ethnic Chinese, would have more say in a political landscape long dominated by Malay Muslims.

On Monday, Lim Guan Eng, secretary general of the Democratic Action Party, which counts Chinese Malaysians among its core supporters, condemned those within his old alliance who “attempted to form a backdoor government to replace the existing democratically elected” government.

“Such political manipulation has affected the government’s effort to address economic and livelihood of Malaysian businesses and the ordinary [citizens],” Lim said.

The DAP and the two other parties remaining in the ruling coalition have pledged their continued support for Mahathir. They said Monday that they will urge him to remain in power, citing his ability to fight corruption.

Within the changing fortunes of the country’s politicians, Welsh said, is the issue of minority politics in Malaysia, where both politics and economics have long played out along racial lines.

“Will this new government be an inclusive one, or one based on racial primacy?” Welsh asked. “These are things at the core of this — yet, for the people who are involved in these elite deals, it is all about money and power and who is getting what positions.”

Edward reported from Kuala Lumpur, Malaysia.