By the mid-1990s it had become clear that the most serious threat to Mahathir's power was the leadership ambition of his deputy, Anwar.
Anwar began to distance himself from Mahathir, overtly promoting his superior religious credentials and appearing to suggest he favoured loosening the restrictions on civil liberties that had become a hallmark of Mahathir's premiership.
However, Mahathir continued to back Anwar as his successor until their relationship collapsed dramatically during the Asian financial crisis.
Their positions gradually diverged, with Mahathir abandoning the tight monetary and fiscal policies urged by the IMF.
At the UMNO General Assembly in 1998, a leading Anwar supporter, Ahmad Zahid Hamidi, criticised the government for not doing enough to combat corruption and cronyism.
As Mahathir took the reins of Malaysia's economic policy over the coming months, Anwar was increasingly sidelined.
On 2 September, he was dismissed as deputy prime minister and finance minister, and promptly expelled from UMNO.
No immediate reasons were given for the dismissal, although the media speculated that it related to lurid allegations of sexual misconduct circulated in a "poison pen letter" at the general assembly.
As more allegations surfaced, large public rallies were held in support of Anwar.
On 20 September, he was arrested and placed in detention under the Internal Security Act.

Anwar stood trial on four charges of corruption, arising from allegations that Anwar abused his power by ordering police to intimidate persons who had alleged Anwar had sodomised them.
Before Anwar's trial, Mahathir told the press that he was convinced of Anwar's guilt.
He was found guilty in April 1999 and sentenced to six years in prison.
In another trial shortly after, Anwar was sentenced to another nine years in prison on a conviction for sodomy.
The sodomy conviction was overturned on appeal after Mahathir left office.

While Mahathir had vanquished his rival, it came at a cost to his standing in the international community and domestic politics.
US Secretary of State Madeleine Albright defended Anwar as a "highly respectable leader" who was "entitled to due process and a fair trial".
In a speech in Kuala Lumpur, which Mahathir attended, US Vice-President Al Gore stated that "we continue to hear calls for democracy", including "among the brave people of Malaysia".
At the APEC summit in 1999, Canadian Prime Minister Jean Chrétien refused to meet Mahathir, while his foreign minister met with Anwar's wife, Wan Azizah Wan Ismail.
Wan Azizah had formed a liberal opposition party, the National Justice Party (Keadilan) to fight the 1999 election.
UMNO lost 18 seats and two state governments as large numbers of Malay voters flocked to PAS and Keadilan, many in protest at the treatment of Anwar.

In September 2001 debate was caused by Mahathir's announcement that Malaysia was already an Islamic state.
At UMNO's general assembly in 2002, he announced that he would resign as prime minister, only for supporters to rush to the stage and convince him tearfully to remain.
He subsequently fixed his retirement for October 2003, giving him time to ensure an orderly and uncontroversial transition to his anointed successor, Abdullah Badawi.
In a speech made before the Organization of the Islamic Conference shortly before he left office, Mahathir claimed "the Jews rule the world by proxy: They get others to fight and die for them."
His speech was denounced by President George W. Bush.
Having spent over 22 years in office, Mahathir was the world's longest-serving elected leader when he retired.
By the mid-1990s it had become clear that the most serious threat to Mahathir's power was the leadership ambition of his deputy, Anwar. Anwar began to distance himself from Mahathir, overtly promoting his superior religious credentials and appearing to suggest he favoured loosening the restrictions on civil liberties that had become a hallmark of Mahathir's premiership. However, Mahathir continued to back Anwar as his successor until their relationship collapsed dramatically during the Asian financial crisis. Their positions gradually diverged, with Mahathir abandoning the tight monetary and fiscal policies urged by the IMF. At the UMNO General Assembly in 1998, a leading Anwar supporter, Ahmad Zahid Hamidi, criticised the government for not doing enough to combat corruption and cronyism. As Mahathir took the reins of Malaysia's economic policy over the coming months, Anwar was increasingly sidelined. On 2 September, he was dismissed as deputy prime minister and finance minister, and promptly expelled from UMNO. No immediate reasons were given for the dismissal, although the media speculated that it related to lurid allegations of sexual misconduct circulated in a "poison pen letter" at the general assembly. As more allegations surfaced, large public rallies were held in support of Anwar. On 20 September, he was arrested and placed in detention under the Internal Security Act.
Anwar stood trial on four charges of corruption, arising from allegations that Anwar abused his power by ordering police to intimidate persons who had alleged Anwar had sodomised them. Before Anwar's trial, Mahathir told the press that he was convinced of Anwar's guilt. He was found guilty in April 1999 and sentenced to six years in prison. In another trial shortly after, Anwar was sentenced to another nine years in prison on a conviction for sodomy. The sodomy conviction was overturned on appeal after Mahathir left office.
While Mahathir had vanquished his rival, it came at a cost to his standing in the international community and domestic politics. US Secretary of State Madeleine Albright defended Anwar as a "highly respectable leader" who was "entitled to due process and a fair trial". In a speech in Kuala Lumpur, which Mahathir attended, US Vice-President Al Gore stated that "we continue to hear calls for democracy", including "among the brave people of Malaysia". At the APEC summit in 1999, Canadian Prime Minister Jean Chrétien refused to meet Mahathir, while his foreign minister met with Anwar's wife, Wan Azizah Wan Ismail. Wan Azizah had formed a liberal opposition party, the National Justice Party (Keadilan) to fight the 1999 election. UMNO lost 18 seats and two state governments as large numbers of Malay voters flocked to PAS and Keadilan, many in protest at the treatment of Anwar.
In September 2001 debate was caused by Mahathir's announcement that Malaysia was already an Islamic state. At UMNO's general assembly in 2002, he announced that he would resign as prime minister, only for supporters to rush to the stage and convince him tearfully to remain. He subsequently fixed his retirement for October 2003, giving him time to ensure an orderly and uncontroversial transition to his anointed successor, Abdullah Badawi. In a speech made before the Organization of the Islamic Conference shortly before he left office, Mahathir claimed "the Jews rule the world by proxy: They get others to fight and die for them." His speech was denounced by President George W. Bush. Having spent over 22 years in office, Mahathir was the world's longest-serving elected leader when he retired.
Mahathir Mohamad