An alliance of Malaysian opposition parties led by the country's 92-year-old former authoritarian leader Mahathir Mohamad won a fiercely contested general election, ending the 60-year rule of the Malay-dominated National Front.
The result is a political earthquake for Muslim-majority Malaysia, sweeping aside the government of Prime Minister Najib Razak, whose reputation was tarnished by a monumental corruption scandal and the imposition of an unpopular sales tax that hurt many of his coalition's poor rural supporters.
It is also a surprising exception to backsliding on democratic values in Southeast Asia, a region of more than 600 million people where governments of countries including Thailand, Cambodia, and the Philippines have swung toward harsh authoritarian rule.
Official results show the opposition parties, which banded together as the Alliance of Hope, surpassed the 112 seats needed for a majority in parliament.
Mr. Mahathir in a televised address Thursday said a representative of Malaysia's constitutional monarchy had contacted the opposition to acknowledge its victory. A prime minister would be sworn in within a day, he said, which would make Mahathir the world's oldest elected leader. He said Thursday and Friday would be public holidays, another slap for Najib, who on election eve had promised public holidays if his coalition won.
Mahathir was credited with modernizing Malaysia during his 22 year rule that ended in 2003 but was also known as a heavy-handed leader who imprisoned opponents and subjugated the courts. Remarkably robust for 92, he pledged that the new government would not seek "revenge" against political opponents. It would, however, seek to restore the rule of law and prosecute those who had breached it, he said.
Analysts said the win by the opposition was a resounding rejection of Malaysia's political status quo.
"This is a repudiation of Najib's government from all walks of life from the very rural northern states to the more industrial southern coast," said Bridget Welsh, a Southeast Asia expert at John Cabot University in Rome.
Angered by the graft scandal, Mahathir emerged from political retirement and joined the opposition in an attempt to oust Najib, his former protege.
The United States Justice Department says $4.5 billion was looted from state investment fund 1MBD by associates of Najib between 2009 and 2014, including $700 million that landed in Najib's bank account. He has denied wrongdoing.
The opposition also made big gains in state elections including winning Johor state, where the dominant Malay party in the long-ruling National Front coalition was founded.
"The person who has made this happen is Mahathir. He has been a significant game changer. He made people feel that a transition of power is possible," said Welsh, in Kuala Lumpur to observe the polls.
Analysts previously said the National Front might lose the popular vote but hold onto a majority in parliament due to an electoral system that gives more power to rural Malays, the party's traditional supporters.
Faced with a reinvigorated opposition, the government used all the levers of power to further tilt the playing field in its favor, critics and analysts said.
Redrawn electoral boundaries were rushed through parliament last month, pushing likely opposition voters into districts that already support the opposition and dividing constituencies along racial lines.
A recently passed "fake news" law was an attempt to stifle debate and criticism, opponents said.
Najib has not publicly reacted to the election result. His aide told media Najib would hold a press conference later in the day.
"For the first time we can actually talk about establishing a true democracy based on the rule of law," said Ambiga Sreenevasan, a prominent lawyer and rights activist. "The true heroes are the Malaysian people because they came out in overwhelming numbers so there could be no cheating," she said.
The National Front lost its two-thirds majority in parliament in 2008 polls and lost the popular vote in 2013, though it still won 60 percent of seats that year.
Mahathir's victory was surreal for his family.
"It seemed so difficult. Impossible. I didn't dare think even though I was out there and I saw the crowds," said his daughter Marina Mahathir. "He is a veteran, he knows how to do this."
This story was reported by The Associated Press. Ivy Sam in Kuala Lumpur, Malaysia contributed.