Their unusual union was based on the promise that Mr Mahathir would one day cede power to Mr Anwar, despite an open power tussle between the two leaders that has shaped the South East Asian nation’s politics for decades.

Mr Anwar, the People's Justice Party (PKR) leader, claimed on Sunday night to have been "betrayed" by Mr Mahathir's party and members of his own group, the People’s Justice Party (PKR), as part of a ploy to block his ascension to the country’s highest office.

He alleged they were plotting to form a new government with the United Malays National Organisation (UMNO), the former ruling party ousted in 2018 amid widespread corruption accusations linked to the 1 Malaysia Development Berhad national investment fund.

Reports suggest that Mr Mahathir’s party joined with a faction of Mr Anwar’s party to meet with officials from UMNO and the Islamist party PAS to form a new government that would possibly back the nonagenarian in serving out a full five-year term as leader.

The negotiations, which some have described as a form of “self-coup”, mark a sharp U-turn from the ruling coalition’s alliance in the run up to 2018 election with Mr Anwar to defeat an UMNO-led government that had lost the public’s trust.

In a pre-election interview with the Telegraph, Mr Mahathir said that the core objective was to push Mr Najib out of office.

“Everyone is agreed, all the opposition parties are agreed, I agree that we should get rid of this prime minister ... no single party can win against him so we have to form a coalition of the opposition,” he said.

He praised Mr Anwar as a “charismatic leader” and endorsed him as successor. “If he becomes eligible then he should become the prime minister. That is depending upon the people’s choice, not my choice,” he said.

Mr Mahathir added: “If the party wants me to step down, I will step down. I am a creature of the party. I am not a dictator as they say. What the party wants me to do, I will do.”

Champa Patel, director of the Asia-Pacific programme at think tank Chatham House, said that the prime minister’s resignation was “less surprising than it seems”.

“The ruling coalition was built on the need to oust Najib rather than a shared vision for the country. It has never been clear when the promised political transition from Mahathir to Anwar Ibrahim would take place. And despite being 94, Mahathir gives no impression he is ready to give up political power,” she said.

“What happens next remains to be seen – whether a new election or Mahathir forming a new coalition. But one thing we can be sure of is that Mahathir is likely to remain a key player in Malaysian politics.”

Since Sunday, leaders of the main parties have been meeting with the king, who plays a largely ceremonial role in Malaysia. It is not immediately clear what they have discussed or whether a new coalition would have the monarch’s backing.

The political drama raises questions about the push to fight the corruption which engulfed the administration after billions of dollars were allegedly siphoned off from the 1MDB fund. Mr Najib is currently standing trial for his alleged role in the scandal.