Former Prime Minister Mahathir Mohamad pulled off a stunning upset in parliamentary elections in Malaysia last week. That win ended six decades of rule by the Barison Nasional (BN), which was headed by his former protege, Prime Minister Najib Razak. The proximate cause of the surprise win was popular anger and disgust over a multibillion-dollar corruption scandal that had hung over Malaysian politics for several years, but economic mismanagement and a sense of malaise after 60 years of uninterrupted rule also contributed. While the win is a victory for democracy in a region that has experienced many recent setbacks in that area, much now depends on Mahathir, a wily politician with a long appreciation of and affection for Japan.

Najib has been in trouble since U.S. investigators charged that Malaysian officials had looted 1MDB, an economic development fund he established in 2009, of at least $4.5 billion, and that $700 million was taken by the prime minister himself. He denied wrongdoing, and was cleared by the attorney general, a verdict that was tainted after Najib dismissed the former chief legal officer.

The scandal prompted Mahathir, who had governed Malaysia from 1981 to 2003, to declare himself "embarrassed" by the allegations, to leave BN and join the opposition Pakatan Harapan (Alliance of Hope). In January, he announced that he would return to the electoral fray. Last week, that about-face produced stunning results: His alliance won 121 seats, 19 more than needed for a majority. The BN won just 79 seats, down from 133 in the previous legislature. Mahathir was sworn in a day after the ballot, after Najib conceded defeat and then stepped down as a head of his party. His first task is forming a government — and he has promised an immediate pardon for opposition leader Anwar Ibrahim, who was jailed in 2015 on sodomy charges that were thought to have been made up by the government to crush the most formidable challenger to its rule.