Image copyright Getty Images Image caption Mahathir had previously served as the country's prime minister from 1981 to 2003

At the age of 94, Mahathir Mohamad is a name that has dominated Malaysian politics for decades.

He was voted in as the country's prime minister in 2018, but in February 2020, found himself ousted in a twist of events that saw the collapse of the governing coalition.

Mahathir had previously served as the country's prime minister from 1981 to 2003.

But in 2018, he came out of retirement in a bid to take down former prime minister Najib Razak - who has been accused of embezzling hundreds of millions in state funds.

Mr Mahathir, together with former coalition leader Anwar Ibrahim, successfully took down Mr Najib.

But the alliance showed that it could not withstand the weight of internal rivalries. Mr Mahathir's resignation triggered the collapse of the Pakatan Harapan coalition, paving the way for a new prime minister.

As quickly as it begun, Mr Mahathir was removed from the post, replaced by a former party member of his - Muhyiddin Yassin. Mr Mahathir has described the appointment of Mr Muhyiddin as illegal and a betrayal.

But the saga is still far from over - and it's clear Mr Mahathir will not go down without a fight.

Humble beginnings

Mr Mahathir joined political party United Malays National Organisation at the age of 21 and ran a medical practice for seven years in his home state of Kedah before becoming a member of parliament in 1964.

In 1969 he lost his seat and was expelled from the party after writing an open letter attacking the then Prime Minister Tunku Abdul Rahman.

He later wrote a controversial book entitled The Malay Dilemma. In it, he argued that the country's Malay population had been marginalised, but also castigated them for apathetically accepting a second-class status.

It struck a chord with younger UMNO leaders and he was invited back into the party, re-elected to parliament in 1974, and appointed minister of education. Within four years he had become UMNO's deputy leader and, in 1981, he became prime minister.

Under his rule, Malaysia transformed into one of the Asian economic tigers of the 1990s - prestige projects such as the Petronas Twin Towers demonstrated the extent of his ambitions.

His authoritarian but pragmatic policies won him popular support at home, though this was tempered by his scant regard for human rights.

Black eye for democracy

Opposition politicians were jailed without trial under a much-criticised Internal Security Act.

Most infamously, his deputy prime minister, Anwar Ibrahim, was sacked, accused of corruption and sodomy and later jailed on the latter charge, when he called for economic and political reforms in 1998.

Image copyright AFP Image caption The opposition Pakatan Harapan logo is an eye - a reference to the black eye Anwar Ibrahim received while in custody

Frequent barbed comments about the West also earned Mr Mahathir a reputation abroad. Days before he resigned in October 2003, for example, he angered several foreign governments and Jewish groups by claiming a Jewish cabal "ruled the world".

He said he left his post "disappointed... because I have achieved too little in my principal task of making my race a successful race, a race that is respected".

Bitter medicine

Even in retirement, he never really left the political arena.

He publicly criticised his successor Abdullah Badawi and, after lacklustre election results for the ruling coalition in 2008, quit the party in what many saw as a way to pressure Mr Abdullah to go.

That paved the way for Mr Najib to come to power.

Mr Mahathir's initial support for Mr Najib changed, however, as accusations of corruption against him surfaced in regard to a heavily indebted state investment fund called 1Malaysia Development Berhad (1MDB).

He commanded enough loyalty from supporters within UMNO to press the case against Mr Najib from within the party and government.

When they got nowhere, however, he, and several high-profile supporters quit UMNO and crossed over to the opposition in 2016.

In January 2018, he announced his intention to contest the election, at the age of 92.

Image copyright AFP Image caption Mr Mahathir was one of the oldest country leaders in the world

On 9 May, he won a historic victory, ousting his former allies after more than 60 years in power.

He, together with Mr Anwar and several other parties, formed the Pakatan Harapan coalition, which ruled the country for two years before it collapsed.

Mr Mahathir threw the country's politics into turmoil in late February 2020 when he resigned, breaking his alliance with Mr Anwar.

But after his resignation, he and Mr Anwar later announced that they had, in fact, reunited again and commanded majority support.

But the king, Sultan Abdullah Sultan Ahmad Shah, who had ultimate say on who should form a government, chose Mr Muhyiddin.

A former interior minister, Mr Muhyiddin once controversially described himself as "Malay first" and Malaysian second.

BBC Monitoring reports and analyses news from TV, radio, web and print media around the world. You can follow BBC Monitoring on Twitter and Facebook.