Ninety-two-year-old Mahathir Mohamad was sworn in as the world's oldest elected leader after a stunning election win that swept Malaysia's establishment from power after more than six decades.
Dressed in a traditional Muslim Malay outfit, he was sworn in by King Sultan Muhammad V at the national palace.
The ceremony at the official state palace in Kuala Lumpur ended a day of uncertainty during which rumors swirled that the National Front, Malaysia's ruling party for 60 years, would try to stay in power.
As he was inaugurated, hundreds of revelers outside the palace cheered and sang the national anthem, with some breaking down in tears. Fireworks lit up the night sky across Kuala Lumpur.
In a huge political upset, Mahathir's opposition alliance, co-lead by jailed opposition leader Anwar Ibrahim, broke the grip on power of the Barisan Nasional (BN) coalition, which had governed Malaysia uninterrupted since its birth as an independent country in 1957.
Mahathir was Malaysia's prime minister for 22 years until 2003. He returned to politics to oust his former protege Najib Razak, who was tarnished by allegations of massive theft from a state investment fund.
"We need to have this government today without delay," Mahathir said before the ceremony. "There is a lot of work to be done. You know the mess the country is in and we need to attend to this mess as soon as possible and that means today."
"We feel so united tonight," 24-year-old student Abdul Aziz Hamzah, who was among the crowd, told AFP. "Mahathir is so insightful and experienced because he's been here before."
One of the most remarkable aspects of Mahathir's comeback has been his reconciliation with jailed opposition icon Anwar Ibrahim, his former nemesis. Their relationship has loomed large over the Malaysian political landscape for decades.
Anwar was Mahathir's heir-apparent until the premier sacked him in 1998 over political differences, and he was subsequently jailed on charges widely believed to be fabricated by the National Front to crush the opposition.
Anwar was jailed again during Najib's rule but is due out in June -- and Mahathir has pledged to help him get a royal pardon, allowing him to run for political office again and potentially become prime minister.
The opposition faced an uphill battle at the election due to what critics said were no-holds-barred attempts by Najib to hang on to power.
His government was accused of gerrymandering while activists said he hurled cash and gifts at voters and there was a litany of problems with the electoral roll, including dead people appearing on the list.
Najib called the vote mid-week, in what critics said was an effort to keep turnout down -- elections are normally held at a weekend in Malaysia. But in the end voters flocked to the polls in droves in a determined bid to push him out.
As it became clear that BN was facing a historic wipeout, Najib disappeared for hours and only surfaced Thursday morning to tell a press conference that he accepted the people's will, but refused to offer a clear concession of defeat.
His comments were slammed by one analyst as "unstatesmanlike."
The opposition's shock victory triggered euphoria and a sense of relief that a leader who was accused of massive graft and fanning racial tensions in the multi-ethnic country was finally on his way out.
"We have been waiting for so long for this to happen," Larson Michael, 35, a voter from just outside Kuala Lumpur, told AFP.
"[Mahathir] has come back to help us regain the country. Now we want to see if he will fulfill... his promises."
Mahathir has vowed to bring him to justice over allegations that billions of dollars were looted from sovereign wealth fund 1MDB, which the scandal-hit leader set up and oversaw.
The U.S. Justice Department says $4.5 billion was looted from 1MBD by associates of Najib between 2009 and 2014, including $700 million that landed in Najib's bank account and a $23 million pink diamond necklace bought for Najib's wife. He has denied wrongdoing.
In Mahathir, the opposition found the perfect person to take on Najib.
He is a staunch supporter of the country's Muslim Malays who could appeal to the country's biggest ethnic group, and whose years in power were remembered as a prosperous period in the country's history.
On the economic front, Mahathir vowed to cancel a goods and service tax imposed since 2015 and said the government could also renegotiate the terms of Chinese loans for infrastructure projects.