Image copyright Getty Images Image caption Mr Mahathir returned to power in 2018

Malaysian PM Mahathir Mohamad has resigned in a surprise move that could unravel the ruling coalition.

The resignation of Mr Mahathir, 94, comes amid rumours that he may form a new coalition without his designated successor, Anwar Ibrahim.

The world's oldest elected leader returned to power in 2018.

In a surprise victory, he ousted then-prime minister Najib Razak, who is on trial charged with taking millions of dollars from a government wealth fund.

The Prime Minister's Office said the letter of resignation to the king was submitted at 13:00 local time (05:00 GMT). No other details were included in the statement.

It is not clear who will be the next prime minister.

No group of parties has sufficient MPs to form a government - so Malaysia's constitutional monarch will play an important role now, either inviting a political leader to form a new administration, or if that fails, calling a fresh general election.

Image copyright Getty Images Image caption Mr Mahathir and Mr Anwar (left) have a complicated political relationship

Mr Mahathir has also resigned from Bersatu, the political party of which he was chairman.

Bersatu had been part of the governing Pakatan Harapan alliance, which he joined in 2018 together with Mr Anwar, and which won the 2018 vote, ending more than six decades of rule by the Barisan Nasional (BN) coalition.

On Sunday, Mr Anwar accused some of Mr Mahathir's party and his own camp of being "traitors", saying they had plans to form a new government, presumably without him.

Mahathir: The master manipulator

Jonathan Head, BBC News

Mahathir Mohammad has played the role of reluctant leader, dragged out of comfortable retirement by the needs of his country, unconvincingly. No-one is fooled.

Until now he has remained the master manipulator in Malaysian politics at the remarkable age of 94. So was he ever sincere about handing over power to Mr Anwar, as agreed, after two years?

He certainly doubted his one-time protégé's abilities to lead a heterogeneous coalition, and he was not alone in that view.

The country's ethnic Malay voters, whose support helped Mr Mahathir win the historic 2018 election, have been drifting back to Umno, the dominant party in the previous ruling coalition.

The idea of forming a new coalition and bringing Umno back in has gained momentum, although the extent to which Mr Mahathir is still pulling the strings is not clear. If that now happens, the hopes reformers had of reshaping Malaysia's notoriously corrupt and patronage-driven politics will be shattered.

The on-again off-again feud between Mr Anwar and Mr Mahathir is one that has dominated Malaysian politics for decades.

Mr Mahathir was prime minister from 1981 to 2003, and was part of the long-ruling Barisan Nasional (BN).

Mr Anwar was his deputy but the relationship soured when Mr Anwar was sacked in 1998 after a leadership dispute.

Media playback is unsupported on your device Media caption Malaysian voters react in 2018 to Mahathir Mohamad's victory over Najib Razak

He was later jailed on corruption and sodomy charges, which were widely regarded as politically motivated.

But in 2018, Mr Mahathir shocked the country when he announced that he was teaming up with Mr Anwar and joining Pakatan Harapan. He said he was doing so to oust the government of Mr Najib, who had become embroiled in the 1MDB corruption scandal.

Mr Mahathir and Mr Anwar's alliance won - and Mr Mahathir agreed to eventually hand power over to Anwar.

But Mr Mahathir repeatedly refused to say when he would transfer power - stoking tensions within the opposition alliance.