Mahathir Mohamad, 94, is a veteran politician who has been Malaysia's prime minister twice. Mohd Samsul Mohd Said l Getty Images

Mahathir Mohamad, a 94-year-old Malaysian politician, unexpectedly quit on Monday — leaving Malaysia in a political limbo and setting the stage for an unprecedented scramble among political parties seeking to form the next government. Mahathir's resignation from the highest political office in Malaysia set off events that broke apart a coalition of parties that ruled the country for less than two years. The political alliance, Pakatan Harapan, unexpectedly won the last general elections in 2018, after overthrowing a rival coalition that had governed Malaysia for 61 years before that. But Mahathir was appointed interim prime minister by the Malaysian king hours after he submitted his resignation — a development that some analysts said has set the veteran politician up to be the kingmaker of Malaysia's political future. As interim premier, Mahathir will continue to oversee administrative matters in the country until the appointment of a new prime minister and cabinet.

"I'm still willing to bet that it'll be Mahathir," said James Chin, an expert on Malaysian politics from the University of Tasmania, when asked who would lead Malaysia next. Monday's developments followed a weekend filled with speculation that the Pakatan Harapan coalition could lose power. Multiple local media, mostly citing unnamed sources, reported that Mahathir would shift allegiance by tying up with the opposition parties to form and lead a new government. CNBC breaks down what led to the latest political upheaval in Malaysia and takes a look at what could happen next.

Who is Mahathir?

Mahathir is a veteran politician who has been Malaysia's prime minister twice. He was premier from 1981 to 2003, during which he led a coalition of political parties called Barisan Nasional. The 94-year-old came out of retirement to form his own party and align with former political opponents to contest the 2018 general elections. Mahathir, and the Pakatan Harapan coalition that he led, beat Barisan Nasional in that election — and for the first time since its independence in 1957, Malaysia had a change in government.

What led to the resignation?

Mahathir didn't explain why he resigned, but analysts and local media reports speculated the issue of succession was likely a central issue. Before the last general elections in 2018, Mahathir had promised that Anwar Ibrahim — his protege-turned-rival before the two reconciled — would succeed him as prime minister. Multiple media reports since then said the 94-year-old was facing pressure from Anwar's supporters to set a timeline to hand over power.

To that, Mahathir often said he needed time to reduce the government's debt and set the country on the right path before stepping down. But he appeared to refuse to commit to a clear timeline on when to cede power, and that raised concerns among analysts and investors about Malaysia's future. Last Friday, leaders from the Pakatan Harapan coalition met to discuss succession, which ended with Mahathir saying a "unanimous" decision was made to allow him to step down whenever he wants to, according to local newspaper The Star. But speculation intensified over the weekend that Mahathir would pull his party out of the coalition and tie up with several opposition parties — including those in the Barisan Nasional coalition that he defeated in 2018.

What's next for Malaysia?

At this point, the Pakatan Harapan coalition has lost its parliamentary majority. Before Monday's events, the alliance was made up of four political parties that held 129 out of 222 parliamentary seats. They included: 50 seats: Parti Keadilan Rakyat, or the People's Justice Party, led by Anwar

42 seats: Democratic Action Party

26 seats: Parti Pribumi Bersatu Malaysia, or the Malaysian United Indigenous Party, led by Mahathir

11 seats: Parti Amanah Negara, or the National Trust Party Mahathir's party announced their withdrawal from the coalition on Monday, while 11 members of parliament — including several cabinet ministers — left Anwar's party to form an independent bloc in the chamber. That left the ruling coalition with 92 seats, short of the 112 simple majority needed to form a government.

What they want is a new government as fast as possible and (that is) as stable as possible — and the only person who can glue everything together at the present moment is Mahathir. James Chin University of Tasmania