Mahathir, 94, the world's oldest leader, has been appointed interim leader while intense political jockeying is underway to form a new government.
Here are some details about the political crisis and what could happen next:
The ruling "Pact of Hope" coalition, an uneasy alliance cobbled together to unseat a corrupt government at 2018 polls, had long been riven by bitter infighting over who would succeed Mahathir.
Anwar, a former opposition icon previously jailed for years on questionable charges, had been named as leader-in-waiting, but a rival faction in his own party was pushing a different candidate, Azmin Ali.
Tension came to a head at the weekend when Azmin launched a bid with several ruling coalition MPs to join opposition groups and form a new coalition excluding Anwar, which would have ended his hopes of becoming premier.
By Monday morning, February 24, that effort had failed, and then Mahathir resigned – putting the nail in the coffin of the already-shaky coalition.
Some lawmakers say Mahathir quit in disgust at the power grab, but analysts also speculate that Mahathir – who has long had a stormy relationship with Anwar – may have given the scheme his blessing despite not publicly backing it.
Far from it, and if anything he may emerge stronger.
Malaysia's king appointed Mahathir interim prime minister, and a growing number of lawmakers have voiced their support for him remaining as premier.
Rival factions of MPs rushed to visit him at his office Tuesday, February 25, apparently seeking to win a spot in a new government.
James Chin, a Malaysia expert from the University of Tasmania, said that Mahathir had resigned for "tactical reasons – he wants a free hand to set up a new government."
The alternative could be an alliance of mainly opposition groups, including the scandal-plagued party of ex-leader Najib Razak.
His government lost power in 2018 in large part due to allegations he plundered state fund 1MDB.
Not good. Mahathir pledged before the 2018 election to eventually hand power to Anwar if their coalition won, and only last week promised to do so after a summit of the Asia-Pacific Economic Cooperation (APEC) forum in Malaysia in November.
But with a new government set to take power, it is not clear if that will be honored.
"The promise to hand over power after APEC by Mahathir has been invalidated by these events," Kadir Jasin, an adviser to Mahathir, told Agence France-Presse.
The "Pact of Hope" coalition "is no longer the government," he added.
With a mixture of anger and bemusement that the democratically elected government, whose election sparked hopes of a new era in a country with a corruption-riddled political system, has been swept away so quickly.
"We are utterly disgusted by such political machinations by both the government and opposition MPs who defy democratic norms of responsible party politics," said a statement from a coalition of NGOs.
A flurry of political negotiations is expected over the coming days before a new government emerges.
With little clarity on how the crisis would end by Tuesday, Malaysia's king said he would interview all the country's 221 MPs to find out who they backed to become the next premier.
While his role is mainly ceremonial, the king appoints the prime minister, who must have the backing of most lawmakers in the lower house of parliament.
Still, the real political maneuvering will happen behind closed doors, and Mahathir looks in a strong position to return as premier.
A snap poll is also possible.
As interim leader, Mahathir has a "short window" to form a government "before there will be pressure to call elections," said Bridget Welsh, an analyst at the Hu Feng Center for East Asia Democratic Studies. – Rappler.com