It was seen as a historic turning point - an election that overturned a party which had been in power for more than 60 years.
But less than two years later, the new government is out, and the old ruling party back in power. So why did a coalition whose victory had ignited such hopes for change in Malaysia collapse so quickly?
Malaysia has a new prime minister after a week of unprecedented political turmoil and uncertainty. Muhyiddin Yassin is an unassuming career politician who was ejected from the then-government party Umno in 2016.
He joined forces with political heavyweights Mahathir Mohammad and Anwar Ibrahim to form a multi-party, multi-ethnic coalition called Pakatan Harapan (PH).
Together they rode a wave of public anger over corruption to inflict the first-ever election defeat on the Umno-led coalition Barisan Nasional (BN).
But the events of the past week - in which Mr Muhyiddin brought down the government by defecting with more than 30 MPs, and forming an alliance with his old party - have been a shattering blow to those who saw the 2018 election as a watershed, a new beginning for the country.
"I am sorry for failing you. I tried. I really tried to stop them", tweeted Syed Saddiq, a telegenic young Malay politician whose stunning victory in a Johor seat in 2018 was seen as emblematic of the hunger for change.
A member of Mr Muhyiddin's party, Syed Saddiq, is refusing to join him in working with Umno. There have been protests against what is being called a "backdoor government".
"This is utter betrayal," said lawyer and activist Fadya Nadwa Fikri. "People didn't vote for this."
Pakatan was an eclectic coalition, bringing together the reformist Keadilan party of Anwar Ibrahim, the main ethnic Chinese party, the DAP, and two anti-Umno Malay parties, Amanah and Bersatu.
The last was led by Mahathir Mohamad, the veteran former prime minister whose backing was crucial to reassuring ethnic Malays that it was safe to abandon the ruling party.
Pakatan was also supported by a network of civil society organisations which had been campaigning for years against corruption and abuses of power.
Right up to polling day on 9 May 2018 they could not be sure they would succeed in dislodging Barisan. But there was a tangible sense of excitement, of possibilities.
Mr Mahathir had campaigned wittily on the theme of then-prime minister Najib Razak and his wife Rosmah as a pair of thieves.
The rising cost of living, and in particular an unpopular sales tax, played into the hands of the opposition. And the Malay vote, normally reliably pro-government, was split three ways, between Pakatan, Barisan and the Islamic party PAS.
When I encountered people at polling stations showing me their Umno veterans' cards, but telling me they were voting for the opposition, it seemed momentum was moving that way.
There was jubilation when Mr Najib conceded the next day. He was the first prime minister from his party to lose an election.
So what went wrong for the Pakatan government?
It was always going to be an uneasy coalition. Mr Mahathir and Anwar Ibrahim had a tortuous history going back 30 years.
Mr Anwar, at one time Mr Mahathir's protégé and designated successor, blames him for his first five-year term in prison.
The two men eventually reconciled and agreed that Mahathir Mohamad, who led the election campaign, would be prime minister if they won, but hand over to Anwar Ibrahim after two years. But exactly how and when that would happen was left unsaid.
There were other personality clashes, and differences over how the coalition would deal with an increasingly harsh economic climate.
"We have the same problem of dissatisfaction as we see in many countries," says Ibrahim Suffian, from the Merdeka Centre for Opinion Research.
"We have economic growth, but wages have not caught up with the cost of living, particularly among the Malay population, particularly among the young.
"The economy is not generating enough jobs that pay well. That was the challenge the coalition faced, because when they entered government they found that most of the cupboards were bare, and that they had enormous debts that they had to deal with."
Malaysia has been defined by ethnic politics since independence in 1957, and the creation of a Malaysian federation in 1963.
Ethnic Malays make up just over half the population; so called "bumiputera", which include other indigenous groups on the Malay peninsular and on Borneo, make up about 68%.
The largest and most successful minority are the Chinese, who migrated to Malaysia during British colonial rule.
Race riots in 1969 persuaded the government that policies favouring bumiputera, and in particular Malays, were essential.
Umno defined itself as the party that looked after the Malays, who tended to be economically less successful than the Chinese. Mahathir Mohamad's 22-year rule in the 1980s and 90s was marked by generous pro-Malay projects, funded by impressive export-led growth.
The downside was rising cronyism and corruption. But Malays still expect government largesse.
It was partly the fear that the Pakatan government, with a large Chinese component, would cut back on that generosity, that has eroded its support among Malays.
A quick trip to a low-income neighbourhood in Gombak, just outside Kuala Lumpur, illustrated this disenchantment.
Here the futuristic highways and high-rises around the city centre give way to drab concrete apartment blocks and rows of small workshops and car-repair garages.
Mohammad Amin, who is building a small café, told me he and his neighbours felt ethnic Malays were not being taken care of as well as in the past.
Muhammad Tarmizi described poorer people in the area as being unable to meet the cost of their most basic daily needs. This government is not looking out for kampung - village - folk, for the Malays, he said.
Although Umno's reputation was badly damaged by the revelations about huge sums of money that went missing in the 1MDB financial scandal, some of it ending up in Mr Najib's personal bank account, the party has been quick to exploit public disappointment over the state of the economy.
So it's little surprise that Pakatan has now lost five out of the last six by-elections. In one contest, in the strategic state of Johor, PH saw its vote drop by more than half.
The crisis broke over the succession. Anwar Ibrahim and his supporters pressed Mr Mahathir for a date, suggesting the two-year anniversary of the election in May. The prime minister refused to be drawn.
Mr Anwar's camp backed off, leaving the decision with Dr Mahathir. But the growing tension within the coalition persuaded Mr Muhyiddin to break away and team up with the other side.
As with every previous crisis in the past 40 years there was an overriding assumption - inside and outside Malaysia - that whatever happened, Mahathir Mohamad, the master manipulator, was pulling the strings, exploiting every twist in a bewilderingly fast-moving drama to ensure he came out on top.
When he stunned the country by tendering his resignation, many of the political factions rushed out to express their support for him to stay in the job.
Even Mr Anwar assured his supporters that, contrary to rumour, Mr Mahathir had not been behind what he was calling a coup against the coalition.
But by the end of the week it was clear that the 94 year-old maestro had miscalculated.
Malaysia's constitutional monarch, King Abdullah, whose role it is to invite a candidate to form a new government, declared that Mr Muhyiddin had the numbers, and would be sworn in as the country's eighth prime minister.
Mr Mahathir has challenged this and could try to bring the new government down once parliament meets again. But incumbency, and the blessing of a revered monarch, are powerful assets for Mr Muhyiddin, which will certainly attract waverers to his side.
"The King cannot make political decisions," says Mustafa Izzuddin at the National University of Singapore.
"But he can play the role of honest broker, bringing the warring sides together. Even then it is unprecedented for a king to do so in Malaysia.
"But Malaysian politics are in uncharted waters, so revolutionary methods may have been necessary. And the King may have seen Muhyiddin as the most trustworthy and steady of the candidates."
It is worth recalling too that Mr Mahathir has a history of conflict with Malaysia's sultans, something that may have been a factor in the King's choice.
Back in 1983 and 1993 he pressed for constitutional changes that imposed limits on royal power.
"In the earlier crisis the role of leading royal resistance to Mahathir was played by the then-Sultan of Pahang, the current king's father," says Clive Kessler at the University of New South Wales.
"Memories and resentments linger on and are not easily forgotten or set aside."
So after less than two years in opposition, Umno is back in power. There are understandable fears that the investigations and trials of Mr Najib, who is still a significant and visible party figure, will be shelved.
Mr Anwar, the man who believed he was destined to be prime minister back in the 1990s, and believed he was promised the job this year, has once again been thwarted.
His repeated career setbacks, over more than two decades, might have come from the plot of one of the Shakespeare tragedies that he read to pass the time while he was serving his two terms in prison.
And Mr Mahathir, one of the most remarkable political survivors of modern times, appears to have run out of road.
As he absorbed the shock of finding himself outmanoeuvred, his wife of 63 years Siti Hasmah put her arms around his waist, in a fierce, protective hug, perhaps hoping that now, a little before his 95th birthday, he might finally retire.