An opposition alliance led by Malaysia's former ruler Mahathir Mohamad has won a majority in parliament - a shock victory that ends the ruling Barisan Nasional (BN) coalition's 60-year grip on power.

The opposition won 113 seats - one more than required for simple majority - and the BN has 79 in the 222-member parliament, according to official results announced on Thursday.

The election race was one of the most closely contested in Malaysia's history, with 92-year-old Mahathir coming out of retirement to take on his former protege, Prime Minister Najib Razak, who has been embroiled in a massive corruption scandal.

Mahathir said he will be sworn in as Malaysia's leader later on Thursday, becoming the oldest prime minister in the world.

As the Pakatan Harapan or Alliance of Hope's win became clear, supporters took to social media and the streets of Malaysia's biggest city, Kuala Lumpur, waving flags of the opposition.

Ads By Google

Al Jazeera’s Rob Mcbride, reporting from Kuala Lumpur, said the mood at a public gathering in the city turned to "euphoria" as "news began to sink in about what was happening".

'Rule of law'

A simple majority of 112 seats is required by a party or alliance to rule, a number Mahathir said his Pakatan Harapan, or Alliance of Hope, secured to defeat Najib's ruling coalition Barisan Nasional.Asked if he would take action against Najib over the financial scandal, Mahathir said he will not seek "revenge".

"We are seeking to restore the rule of law," Mahathir told reporters early Thursday.There was no immediate comment from officials with BN.

Najib, who has ruled the Southeast Asian country for nearly 10 years, said he accepted the "verdict of the people" in Wednesday's election.

The corruption allegations have dogged Najib for years and appeared to have soured Malaysian voters.The US Justice Department says $4.5bn was looted from the 1MBD investment fund by associates of the prime minister between 2009 and 2014, including $700m that landed in Najib's bank account.He denies any wrongdoing.

Game changer

The Pakatan Harapan's win was a stunning triumph that almost no one had predicted. Bridget Welsh, a Southeast Asia expert at John Cabot University in Rome, attributed the opposition's surprising gains to Mahathir.

"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," she said.

"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," she said.

The opposition was also sweeping state elections, including Johor state where the dominant Malay party in the Barisan Nasional was founded.

"Few Malaysians thought they would live to see this day," Malaysia Kini, a Malaysian news website, said in an editorial. "This is the first time the country has witnessed a change of government since independence from the British in 1957."

BN's rout was made possible by a "Malaysian tsunami", in which all major ethnic groups turned out to vote against the ruling coalition, it said.

"Nothing less than a historic political earthquake is under way in Malaysia right now," said John Sifton, Human Rights Watch's Asia advocacy director.

Anwar pardon

Mahathir turned against Najib in the wake of the financial scandal at 1MDB, calling his role in Najib's rise "the biggest mistake of my life".

The former ruler then teamed up with an alliance of parties that opposed him when he was in power.That included opposition icon Anwar Ibrahim, his former deputy who was jailed for sodomy and corruption - charges Anwar maintains were politically motivated after he and Mahathir fell out in the late 1990s.

After claiming victory, Mahathir told reporters he will work on obtaining a royal pardon for Anwar, who is serving a five-year prison sentence.

"Once [Anwar] is pardoned, he will be eligible to stand as prime minister. But he still must stand for elections to be an MP," Mahathir was quoted as saying by The Star newspaper.

Many Malaysian social media users praised Mahathir and thanked the people of Malaysia for the shock victory, while still others expressed disbelief at the results.

"This feels so surreal ... We've been so desperate for a transformation," wrote one Twitter user, Phoebe Shafinaz, while another user, Aminah Ibrahim, said she was in "tears of utter happiness".

Iman Tanita al Ghul, meanwhile, urged the new government to "uphold the rule of law".