Former Malaysian prime minister Mahathir Mohamad has scored a historic victory in the general election, official results show.
The election commission said Mr Mahathir’s opposition alliance had won 115 seats, over the threshold of 112 seats needed to form a government.
Mr Mahathir, 92, defeated the governing Barisan Nasional coalition, which has been in power for more than 60 years.
He came out of retirement to take on his former protégé, Najib Razak.
“We are not seeking revenge, we want to restore the rule of law,” Mr Mahathir told reporters.
He said he hoped a swearing-ceremony would be held on Thursday.
Critics had raised concerns that the election might not have been free and fair.
Addressing reporters in Kuala Lumpur earlier, Mr Mahathir said he was convinced opposition alliance Pakatan Harapan had done enough to secure victory. “There is no way they can catch up,” he said, referring to BN.
The campaign pitted Mr Mahathir’s opposition group against the BN, which is led by incumbent Prime Minister Najib Razak.
The BN and its major party, the United Malays National Organisation (UMNO), have dominated Malaysian politics since since the country won independence from Britain in 1957, but the once-powerful coalition has seen its popularity decline in recent years.
In the previous election, in 2013, the opposition made unprecedented gains, winning the popular vote, but it failed to win enough seats to form a government.
In a dramatic turn of events, then-opposition leader Anwar Ibrahim was sentenced to five years jail on sodomy charges, which he said were part of a political smear campaign.
Mr Mahathir, who was once an integral part of BN and a mentor to Mr Najib, abandoned the coalition in 2016.
As he left, he said he was “embarrassed” to be associated with a party “that is seen as supporting corruption”.
Mr Najib has been embroiled in a corruption scandal, which saw him accused of pocketing some $700m from the 1Malaysian Development Berhad, a state investment fund.
He has vehemently denied all allegations and been cleared by Malaysian authorities.
The fund is still being investigated by several countries and Mr Najib has been accused of stifling Malaysian investigations by removing key officials.
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, who are traditionally BN supporters.
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.
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.
The government has insisted the election will be free and fair, with Mr Najib saying that the EC acted “for the good of all”.
Voters were electing 222 members of parliament as well as state assembly members in 12 of the 13 states.
Malaysia uses a first-past-the-post electoral system, where the party that gets the most seats in parliament wins even if it does not win the popular vote.