Malaysia's king held unusual consultations with lawmakers for a second day Wednesday to resolve a political vacuum caused by the abrupt collapse of the ruling coalition and the resignation of Prime Minister Mahathir Mohamad.

The king's role is largely ceremonial in Malaysia, but he appoints the person with majority support in Parliament as prime minister.

Sultan Abdullah Sultan Ahmad Shah met with 83 lawmakers on Tuesday and is meeting the remaining 139 now to determine who they support as prime minister and if they want fresh elections.

A supporter of People's Justice Party wearing a national flag face mask as he gathers with others outside the National Palace in Kuala Lumpur, Malaysia, Wednesday, Feb. 26, 2020. Malaysia's ruling alliance collapsed this week after 94-year-old Prime Minister Mahathir Mohamad resigned and dozens of lawmakers defected in an audacious attempt to form a new government. The political earthquake occurred less than two years after the alliance won a historic election that ousted a corruption-tainted coalition that had ruled for 61 years. (AP PhotoVincent Thian)

A supporter of People's Justice Party wearing a national flag face mask as he gathers with others outside the National Palace in Kuala Lumpur, Malaysia, Wednesday, Feb. 26, 2020. Malaysia's ruling alliance collapsed this week after 94-year-old Prime Minister Mahathir Mohamad resigned and dozens of lawmakers defected in an audacious attempt to form a new government. The political earthquake occurred less than two years after the alliance won a historic election that ousted a corruption-tainted coalition that had ruled for 61 years. (AP PhotoVincent Thian)

Mahathir's Bersatu party ditched the ruling alliance Monday but failed to form a new government with parties to thwart an agreed transition of power to Anwar Ibrahim.

The 94-year-old Mahathir resigned as premier and Bersatu chairman in what allies say was a protest of his party's plan to work with the former corrupt regime that he had ousted in 2018 elections.

The departure of 37 lawmakers, including 11 from Anwar's party, deprived the governing Alliance of Hope of majority rule and sparked a crisis less than two years after its election victory ousted a corrupt-tainted coalition that had ruled for 61 years.

A supporter of People's Justice Party waves its party flag outside the National Palace in Kuala Lumpur, Malaysia, Wednesday, Feb. 26, 2020. Malaysia's ruling alliance collapsed this week after 94-year-old Prime Minister Mahathir Mohamad resigned and dozens of lawmakers defected in an audacious attempt to form a new government. The political earthquake occurred less than two years after the alliance won a historic election that ousted a corruption-tainted coalition that had ruled for 61 years. (AP PhotoVincent Thian)

A supporter of People's Justice Party waves its party flag outside the National Palace in Kuala Lumpur, Malaysia, Wednesday, Feb. 26, 2020. Malaysia's ruling alliance collapsed this week after 94-year-old Prime Minister Mahathir Mohamad resigned and dozens of lawmakers defected in an audacious attempt to form a new government. The political earthquake occurred less than two years after the alliance won a historic election that ousted a corruption-tainted coalition that had ruled for 61 years. (AP PhotoVincent Thian)

The king dissolved the Cabinet but reappointed Mahathir as interim leader.

Anwar and more than three dozen lawmakers from his party arrived at the palace Wednesday morning in an open-top double-decker bus.

“God willing, may there be a good outcome for all,” Anwar tweeted.

The turmoil has strengthened Mahathir's position, with both Anwar's alliance and the defectors trying to grab power by supporting him as their leader. Some analysts said it could allow Mahathir's comeback with a clean slate with Anwar still in the running for the top job.

"The (power transition) deal will have to be renegotiated, but support for Anwar among the (Alliance of Hope) remains strong and he remains the leading contender," said Bridget Welsh, honorary research associate at the University of Nottingham in Malaysia.

The premiership eluded Anwar once two decades ago. Once a high-flying member of the former ruling coalition. Anwar was convicted of homosexual sodomy and corruption after a power struggle with Mahathir, who was prime minister for 22 years until 2003. He was freed in 2004 but was once again convicted for sodomy in 2015, charges that he said were concocted to destroy his political career.

Angered by a massive corruption scandal at a state investment fund, Mahathir made a political comeback and the two men forged an alliance that that ousted Prime Minister Najib Razak’s coalition, which had been in power since independence from Britain in 1957.

Anwar couldn’t participate in the 2018 elections because he was behind bars for a second sodomy conviction. But he was freed and pardoned by the king after the alliance won power. Mahathir initially said he expected to stay as prime minister for two years to clean up the government, but refused to set a firm timeline for passing the baton to Anwar.

Mahathir, the world's oldest leader, has kept mum during the political debacle. He has been meeting with various political leaders and on Tuesday tweeted of meeting with finance ministry officials about a stimulus plan to bolster the economy hurt by the COVID-19 illness.

Leaders from two opposition Malay parties, which jointly control a quarter of the parliamentary seats, have called for fresh elections. The United Malays National Organization, party of disgraced ex-premier Najib who is on trial for corruption, and a fundamentalist Islamic party with strong rural support, said they opposed Mahathir's plan for a unity government that would include rival parties and a Cabinet that isn’t split based on party strength.

Analyst Welsh said their U-turn confirmed that Mahathir won't work with them and that they think their best chances of getting into power are through elections.

“Elections are a real possibility, but after negotiations for a government don't work out," she added.