Anwar Ibrahim appointed Malaysia's next PM

Opposition leader Anwar Ibrahim
Anwar Ibrahim will be sworn in as Malaysian prime minister later on Thursday. -AP

Malaysian opposition leader Anwar Ibrahim has been appointed prime minister, the palace says, and will be sworn in by the king at 5pm (2000 AEDT) on Thursday.

A general election on Saturday ended in an unprecedented hung parliament with neither of two main alliances, one led by Anwar and the other ex-premier Muhyiddin Yassin, immediately able to secure enough seats in parliament to form a government.

The uncertainty over the election prolonged political instability in the Southeast Asian country, which has had three prime ministers in as many years, and risked delaying policy decisions needed to foster economic recovery.

King Al-Sultan Abdullah Sultan plays a largely ceremonial role but can appoint a premier he believes will command a majority in parliament.

Anwar's progressive coalition, known as Pakatan Harapan, won the most seats in the Saturday election with 82, while Muhyiddin's conservative Malay Muslim alliance called Perikatan Nasional won 73.

They need 112 - a simple majority - to form a government.

The incumbent Barisan Nasional, which came in a distant third in the election in its worst electoral showing, has 30.