By Yvette Tan & Jonathan Head
Malaysia's veteran opposition leader Anwar Ibrahim has been sworn in as the country's new prime minister, after several days of post-election deadlock.
The new leader was appointed by King Sultan Abdullah, after elections over the weekend resulted in an unprecedented hung parliament.
Neither Mr Anwar nor ex-premier Muhyiddin Yassin had won the simple majority needed to form a government.
It is not immediately clear who Mr Anwar will go into coalition with.
"After taking into the consideration the views of Their Royal Highnesses the Malay Rulers, His Majesty has given consent to appoint Anwar Ibrahim as the 10th Prime Minister of Malaysia," said a statement released by the palace earlier on Thursday.
The new PM was sworn in by the king in the late afternoon.
Mr Anwar's Pakatan Harapan (PH) party, which won the biggest share of seats in Saturday's election, does not have enough seats on its own to form a government.
It took five days of intense negotiations to reach an agreement on a new government, during which time various combinations of parties and forms of alliances were discussed, and then rejected.
Many of the political leaders have personal and ideological differences which made it hard to find a workable majority.
In the end it was left to Malaysia's constitutional monarch, King Abdullah, to summon all the leaders to the palace to try to find sufficient common ground.
It is not clear what form the new government will take; whether a formal coalition of parties, a minority government with other parties offering a confidence and supply agreement, or a national unity government including all the main parties.
The decision brings to an end a remarkable political odyssey for Anwar Ibrahim, a brilliant orator and, 25 years ago, a fast-rising star everyone expected would replace then-prime minister Mahathir Mohammad.
It was not to be. He and Mr Mahathir fell out over the handling of the Asian financial crisis, and he was jailed on what were widely believed to be politicised corruption and sodomy charges.
His conviction was overturned in 2004, and he returned to politics, leading his own reformist party close to defeating the UMNO party in the 2013 election, only to have new sodomy charges filed against him, and being sent back to jail in 2015.
But as opposition to then-prime minister Najib Razak grew over the huge 1MDB scandal, Mr Mahathir came out of retirement, reconciled with Mr Anwar, and together they helped inflict the first ever defeat of the ruling party in 2018, resulting in Mr Anwar being pardoned by the king.
But the deal they made - that Mr Mahathir, already in his 90s, would hand over the PM's job to Mr Anwar - fell through in 2020 and the top job slipped through his hands again.
Now he has reached his goal but in very challenging conditions, with an economy clobbered by Covid and a need to work together with some of his most bitter political rivals.
The appointment of a government led by Mr Anwar's reformist Pakatan Harapan will be greeted with some relief by non-Malay Malaysians.
The rival Perikatan Nasional is dominated by the conservative Islamist party PAS, which non-Malays feared would push for a more religious and less tolerant kind of government.
But Mr Anwar's goal of promoting a more pluralist, inclusive Malaysia will be difficult to advance, given all the other challenges the new government will face.