Malaysia's former deputy prime minister Muhyiddin Yassin shows a document after submitting an application for a new political party on August 9, 2016.

Malaysia's king named former interior minister Muhyiddin Yassin as the new prime minister on Saturday in a shock decision that sidelined old rivals Mahathir Mohamad and Anwar Ibrahim after a week of political turmoil.

The decision came five days after the resignation of 94-year-old Mahathir, the world's oldest head of government, who broke an alliance with Anwar, 72, that swept the former ruling party from power in a 2018 election victory.

Although Mahathir and Anwar announced on Saturday that they had joined hands again, the palace said in a statement the king made his decision on the basis that Muhyiddin Yassin possibly had the support of a majority in parliament.

"His majesty has decreed that the process of appointing a prime minister cannot be delayed," it added. "This is the best decision for all." Muhyiddin will be sworn in on Sunday.

"I only ask for all Malaysians to accept the decision announced by the national palace," Muhyiddin told reporters at his home.

There was no immediate reaction from Mahathir or Anwar. Muhyiddin, 72, had the backing of the former ruling party United Malays National Organisation (UMNO), that was driven from power after six decades by the Pakatan Harapan alliance of Mahathir and Anwar on an anti-corruption platform.

Former UNMO prime minister Najib Razak is on trial for corruption. But UNMO's fortunes have risen since its 2018 defeat, with the Pakatan coalition losing five by-elections in the face of criticism from some Malay voters that it should do more to favour the country's biggest ethnic group of 32 million.

Muhyiddin also had the backing of Islamist party PAS. UMNO, which Mahathir led from 1981 to 2003 during a previous stint as prime minister, supports Malay nationalism.

The latest crisis was sparked by a tussle for power between Mahathir and Anwar that has shaped Malaysian politics for two decades. Mahathir had promised to hand power to Anwar after the 2018 election, but no date had been set.

Anwar was Mahathir's deputy and a rising political star when Mahathir was prime minister the first time, but they fell out over how to tackle the Asian financial crisis.

Anwar was arrested and jailed in the late 1990s for sodomy and corruption, charges he says were politically motivated.

As well as personal relationships, politics in Malaysia is shaped by a tangle of ethnic, religious and regional interests. Malaysia is more than half ethnic Malay, but has large ethnic Chinese, Indian and other minorities.