But this year, in a bid to remove Najib Razak, who has been accused of a $3.2 billion corruption scandal, Mahathir joined the opposition and agreed to run as its leader.
Newly-appointed Prime Minister Mahathir Mohamad had said yesterday that the ruling coalition would petition the Yang di-Pertuan Agong for a full pardon, and he would be released the same day the pardon was granted.
"Yes, full pardon. We were informed by the King's office", she told Malay Mail when contacted.
He has now sought a royal pardon for Anwar ~ who is still languishing behind bars on a second charge of sodomy ~ and then make way for him to become Prime Minister.
It was a remarkable comeback for Mahathir, who was premier for 22 years until his retirement in 2003 and is now the world's oldest leader at 92.
Pakatan Harapan has named Anwar as the prime minister-in-waiting, with Dr Mahathir having promised to vacate the seat once Anwar is pardoned, released and elected as a lawmaker.
Shipping Will Have Time to Adjust to Iranian Sanctions
Now it's up to the Iranians and other countries involved in the deal to help the world stave off that unnerving possibility. Italy has long-established political and economic ties with Iran, and is its main trading partner within the EU.
Anwar, now 70, was jailed again in 2015 during Najib's rule - after making historic gains as the head of the opposition at the 2013 elections - and had been due to be released next month.
The Southeast Asian nation's political landscape has been shaped for almost two decades by a bitter feud between Anwar and Mahathir, whose decision to sack Anwar as his deputy sparked an opposition movement, Reformasi, or Reform, in 1998.
It was not clear when Anwar, who is now in hospital for treatment to his shoulder, would be freed.
Mahathir said his four-party alliance will hold a meeting Saturday and name 10 ministers for a start.
Mahathir said initial policies would focus on fulfilling promises made in alliance's manifesto, including the abolition of a goods and services tax (GST).
Mahathir said the country's attorney general was wrong to clear Najib in the 1MDB probe in 2016. But he was also credited for transforming his Southeast Asian country from a sleepy backwater into a modern industrialised nation.