Malaysia's veteran opposition leader Anwar Ibrahim will be the country's new prime minister, after a turbulent 25 year pursuit for the job that saw him jailed twice.
Promising to give up his salary as PM, he pledged to fight corruption and focus on the economy.
The new PM was sworn in by the king on Thursday afternoon.
The appointment ends days of post-election deadlock following inconclusive elections.
Mr Anwar's Pakatan Harapan (PH) party, which won the biggest share of seats in Saturday's vote, 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.
Mr Anwar said he would form a "national unity government" with the help of two other political groupings, giving him the majority he needs.
The decision brings to an end a remarkable odyssey for Anwar Ibrahim; a brilliant orator who led a reformist political movement that campaigned to end the monopoly on power held by one party, UMNO.
Twenty-five years ago, everyone expected the fast-rising star to 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.
Having promised to forgo his prime ministerial salary, Mr Anwar says he will tackle Malaysia's rising cost of living and combat corruption.
He also wants to implement reforms including a fixed term parliament act and a ten-year limit on the serving term of prime ministers.
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.