Mahathir Mohamad is on course to become the world’s oldest elected leader at 92, after a shock victory in Malaysia’s bitterly fought election.
The former PM came out of retirement and defected to the opposition to take on his one-time protégé Najib Razak, beset by corruption allegations.
His historic win has ousted the Barisan Nasional (BN) coalition, which has been in power since independence in 1957.
Jubilant Mahathir supporters filled the streets as the victory became clear.
Mr Najib has said he will “accept the verdict of the people”, but correspondents say a smooth transition to power is not a given after such a major political upheaval.
No single party within the coalition won a majority, so technically it now rests with Malaysia’s king to decide who forms a government.
How have people reacted?
“Yes, yes, I am still alive,” Mr Mahathir told a news conference in the early hours of Thursday. He said his coalition would not seek revenge but would “restore the rule of law”.
He also announced – to cheers among his supporters – that there would be a two-day public holiday, adding: “But there will be no holidays for the winners.”
The official results showed the opposition Pakatan Harapan – the Alliance of Hope – secured 113 of the 222 seats being contested, including some which have only ever been held by the government. BN took 79 seats.
Rising living costs and long-running allegations of corruption weighed heavily on many voters and saw them peel away from Mr Najib and his once unshakeable coalition.
“I feel that with this change we probably can see something better in the future,” Suva Selvan, a 48-year-old doctor, told AFP.
“Our hope for the future is a better government, fair, free and united.”
How did Mahathir manage to win?
Mr Mahathir was prime minister, at the head of the BN coalition, for 22 years, from 1981 until he stepped down in 2003.
Under his leadership, Malaysia became one of the Asian tigers – the group of countries which saw their economies expand rapidly in the 1990s. But he was an authoritarian figure who used controversial security laws to lock up his political opponents.
Most infamously his deputy prime minister, Anwar Ibrahim, was sacked and accused of corruption and sodomy – and later jailed on the latter charge – when he called for economic and political reforms.
Mr Mahathir was also a mentor to Mr Najib, who became prime minister in 2008.
But Mr Najib has been dogged by corruption allegations. He has been accused of pocketing some $700m from the 1Malaysian Development Berhad, a state investment fund he set up.
He has vehemently denied all allegations and been cleared by Malaysian authorities but the fund is still being investigated by several countries. Mr Najib has been accused of stifling Malaysian investigations by removing key officials from their post.
Those allegations led to Mr Mahathir’s surprise defection in 2016 from Barisan Nasional to join the Pakatan Harapan, saying he was “embarrassed” to be associated “with a party that is seen as supporting corruption”.
Then in January, he said he would run for the leadership again.
But despite his historic win, uncertainty hangs over his tenure. Prior to his win, he intended to govern for two years before stepping down. He promised he would arrange a pardon for Anwar, clearing the way for him to be re-elected and take the top job.
What controversies surrounded the vote?
Ahead of the election, there were allegations that voting would not be free and fair.
The government recently passed a law redrawing election boundaries, leading to accusations that it had gerrymandered constituencies to ensure they were filled by Malay Muslims, traditionally BN supporters.
A controversial fake news law was also recently introduced, which critics say could be used by the authorities to muffle dissent. Mr Mahathir is himself being investigated under that law after alleging that his plane had been sabotaged.
And in the days before the poll, election reform group Bersih 2.0 accused the Election Commission (EC) of multiple “electoral crimes”, including irregularities in postal voting and failing to remove dead people from the electoral roll.
The government had insisted the election would be free and fair, with Mr Najib saying that the EC acted “for the good of all”.