Malaysia election: What just happened?
A 92-year-old man has just pulled off the most extraordinary election result in Malaysian history. Here's how it happened and what it might mean.
A first time change
Malaysia has been ruled by the same coalition of parties - the Barisan Nasional - since it stopped being a British colony in 1957.
Although its popularity had been declining, most people believed Prime Minister Najib Razak was going to lead it to yet another win.
But the official count showed it didn't win enough seats in parliament to claim victory, a shock to most observers.
Why did they get voted out?
As ever, it's mostly the economy. The cost of living has gone up a lot and the government brought in a new tax on goods and services - never a popular move.
But the biggest story out of Malaysia in recent years has been corruption. Najib Razak had set up a special fund to encourage foreign investment. But people involved in it have been accused of using it for their personal gain.
Najib was even accused of pocketing $700m. Importantly, he has always denied this and has been cleared of wrongdoing at home, but he and the fund are still being investigated by several countries, including the US, so it's been damaging for Malaysia's reputation.
That's where Mahathir Mohamad comes in
He's been prime minister before, as leader of the BN. For 22 years in fact, from 1981 until he stood down in 2003. He was also something of a mentor to Mr Najib.
But two years ago he shocked everyone by saying he was so "embarrassed" by the corruption allegations that he was leaving his old party and would join the opposition, the Pakatan Harapan (Alliance of Hope).
Then in January, he said he would directly challenge his former mentee in the election, saying he felt confident of victory "unless Najib cheats".
And there were a lot of cheating allegations during the election: people said they didn't get their postal ballot, and the government rejigged some constituencies in a way critics said would help it win.
The government also jumped on the global "fake news" panic and rushed through a law which meant you could be jailed for sharing it.
Some people thought that was a way of shutting down criticism of the government. Mr Mahathir has even been charged under the law.
What happens now?
Mr Mahathir was sworn in as prime minister later that day. But it's not clear how long he'll stay.
As part of his campaign, he also said he would hand over power in two years because - reminder - he is 92.
That might deliver another stunning twist, because the next prime minister could well be Anwar Ibrahim, who is currently in jail.
Anwar was Mr Mahathir's deputy prime minister back in the late 1990s, but they fell out. Anwar became a powerful political opponent until he was jailed for abuse of power, then later convicted of sodomy.
He has always said the charges were political, to stop him being a threat to the government and Mr Mahathir.
To convince Pakatan Harapan to let him switch sides and lead them, Mr Mahathir promised to get Anwar pardoned, so he could run for office again and become prime minister. That is looking ever more likely.