Kuala Lumpur: Malaysia's perennial opposition leader Anwar Ibrahim was named prime minister on Thursday, ending a days-long political impasse after inconclusive election results.
The 75-year-old was scheduled to be sworn in at 5 pm (0900 GMT), becoming the country's fourth leader in as many years.
His ascension will cap a turbulent political life for Anwar, during which he has sat near the apex of power, as well as serving jail time on corruption and sodomy charges.
"After taking into 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," read a statement from the palace of the king, Sultan Abdullah Ahmad Shah.
Anwar's multi-ethnic Pakatan Harapan coalition won the most seats in the weekend's election, on an anti-graft message.
But its total of 82 seats was short of the required 112.
The king had summoned Anwar and former prime minister Muhyiddin Yassin - whose Perikatan Nasional bloc got 73 seats - in an attempt to break the deadlock, but no deal could be struck.
Muhyiddin, who was backed by an Islamist party, told reporters Tuesday that the monarch had initially asked him and Anwar to form a "unity government".
For Anwar, the premiership is the culmination of a rollercoaster 25 years.
The firebrand former student activist was close to power in the late 1990s, as finance chief and deputy prime minister to Mahathir Mohamad.
But the two had a bitter falling-out over how to handle the 1997-98 Asian financial crisis.
Mahathir sacked Anwar, who was also expelled from their then party the United Malays National Organisation (UMNO), and charged with corruption and sodomy.
Anwar was sentenced to six years in jail for corruption in 1999, with an additional nine years added for the sodomy charge the following year, the two sentences to run consecutively.
As Anwar claimed political persecution, street protests erupted and evolved into a movement calling for democratic reforms.
The Mahathir-Anwar tussle has dominated and shaped Malaysian politics over the past four decades, "alternately bringing despair and hope, progress and regress to the country's polity", according to Oh Ei Sun of the Pacific Research Center of Malaysia.
The Malaysian Supreme Court overturned Anwar's sodomy conviction in 2004 and ordered him freed.
'Long time coming'
Anwar allied with Mahathir during the 2018 elections, when his erstwhile tormentor came out of retirement to challenge incumbent Najib Razak, who was mired in the billion-dollar 1MDB financial scandal.
Their alliance scored a historic victory against UMNO and Najib, who is now serving a 12-year jail term for corruption.
Mahathir became prime minister for the second time, with an agreement to hand over the premiership to Anwar later.
He never fulfilled that pact, and their alliance collapsed after 22 months, leaving Anwar empty-handed again.
"This is a long time coming for Anwar Ibrahim," Asrul Hadi Abdullah Sani, deputy managing director at strategic advisory firm Bower Group Asia, told AFP.
"One of his agendas is to ensure he is able to fulfil his reform agenda as he looks to stabilise a loosely cobbled federal coalition."
Born on Aug. 10, 1947, Anwar made his name as an Islamic youth leader with anti-government demonstrations highlighting impoverished conditions in northern Malaysia in the mid-1970s.
He had a meteoric political rise under Prime Minister Mahathir Mohamad, who invited him to join the ruling coalition, the United Malays National Organisation (UMNO), in 1982.
Finance minister from 1991 and deputy prime minister from 1993, the long-celebrated heir apparent to Mahathir fell out with his mentor in 1998.
Fallout and jail:
Mahathir sacked his deputy in September 1998, calling him unfit to be leader. Anwar was arrested that month after leading 30,000 protesters through the capital and charged with sodomy and corruption.
Anwar was jailed for six years in April 1999 for abuse of power and received a second, consecutive nine-year term in August 2000 on a sodomy charge.
Though freed in September 2004 after Malaysia's Federal Court quashed the sodomy charges, he was still banned from seeking office until April 2008.
Return to politics:
After historic gains in the March 2008 general election by his People's Justice Party and its allies, Anwar returned to parliament as leader of the opposition.
Just three months after being allowed to run for office again, he faced fresh sodomy charges on June 29 and sought refuge in the Turkish embassy, saying he feared for his life.
Second conviction and jail time:
In 2008, accused of sodomy by a male aide, Anwar said the accusations aimed at removing him from his post of leader of the opposition.
During the term of Prime Minister Najib Razak in 2015, Anwar was jailed for sodomy for the second time.
Anwar and Mahathir buried the hatchet in 2018 and came together to defeat Barisan Nasional for the first time in Malaysia's history, amid public anger at the government over the multi-billion-dollar 1MDB scandal.
Mahathir promises to seek a royal pardon for Anwar and hand him the prime minister's job if the coalition succeeds.
Anwar is pardoned and released within a week after Mahathir leads the opposition coalition to an unprecedented victory in a general election.
Their alliance collapsed less than two years later because of infighting over Mahathir's promise to hand power to Anwar.
2022 polls lead to top job:
Anwar's Pakatan Harapan coalition was forecast to get the largest share of seats, or 35%, in a closely fought election, a survey by British research firm YouGov showed on Nov. 16.
But the election led to an unprecedented hung parliament over the weekend. Anwar's coalition won 82, or 36.9%, of the seats, short of the 112 required for a majority.
Anwar and former Prime Minister Muhyiddin Yassin each said they could form a government with support from other parties.
Malaysia's king appointed Anwar as prime minister after a special meeting of his fellow hereditary sultans.