It was the latest twist in a drama that began when Mahathir, 94, resigned as prime minister and the ruling coalition collapsed following a failed bid to form a new government without Anwar.
If successful, the move would have blocked leader-in-waiting Anwar -- who had joined forces in the coalition with Mahathir to oust a corrupt regime in 2018 -- from becoming premier.
Malaysia’s Mahathir returns as interim PM amid political uncertainty
Both men then staked competing claims to the country's leadership, reviving a rivalry that has shaped the Southeast Asian nation's politics for two decades.
But in a volte-face, Mahathir announced Saturday he had met leaders from Anwar's "Pact of Hope" alliance and believed he had enough support to return as premier. The alliance then announced it was backing him for the post.
The move was aimed at stopping a coalition dominated by the country's Muslim majority, including the party of disgraced ex-leader Najib Razak, which had appeared poised to take power.
"It's time to do the right thing for the (people) and our beloved nation," tweeted Anwar, 72, before heading to hand a letter to the king declaring his coalition's support for Mahathir.
The king formally appoints the country's prime minister, and a candidate must show he has the backing of at least 112 MPs.
If Mahathir does return to power with the backing of Anwar's alliance, the government is likely to be little changed from when it collapsed a week ago.
Intense horse-trading was still underway however and the final outcome was unclear.
Mahathir and Anwar's ruling alliance had been riven by tensions about who would eventually succeed the elderly leader.
Malaysian parliament to decide new PM amid crisis
Mahathir had pledged to eventually hand the premiership to Anwar, but many were sceptical that he would give power to his old rival, and other factions were pushing to take over.
The men's stormy history has loomed over Malaysian politics ever since Mahathir -- during a first stint in office in the 1990s -- sacked Anwar as his deputy, and he was jailed on dubious sodomy charges.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ