Ninety-two-year-old Mahathir Mohamad was on Thursday 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.
In a huge political upset, former strongman Mahathir's opposition alliance 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.
It capped a dramatic political comeback for Mahathir, who previously ruled the country with an iron fist for 22 years and came out of retirement to take on Prime Minister Najib Razak after the leader became embroiled in a massive corruption scandal.
Mahathir, dressed in traditional Malay dress, took the oath of office in a elaborately decorated room, with political allies and senior government officials in attendance.
"I, Mahathir Mohamad, after being elected as prime minister, swear to carry out my task with all my ability, and that I will be loyal to Malaysia and preserve and defend the constitution," he said.
As he was sworn in, fireworks lit up in the night sky across Kuala Lumpur as people celebrated.
Earlier, Mahathir and his wife Siti Hasmah Mohamad Ali were driven into the palace past hundreds of well-wishers waving flags and chanting the national anthem.
Mohamad Azlan Shah, a member of Mahathir's party in the crowd, said he was "very proud".
"Our struggle to change Malaysian politics is not wasted. We believe Mahathir can make a change," he told AFP.
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 of sodomy and abuse of power.
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.
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, although he stopped short of conceding 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 fulfil... his promises." The initial delight at the opposition victory will likely give way to some apprehension. Mahathir was also accused of being an authoritarian leader, and political opponents were thrown in jail during his time in office.
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.
In the event, voters turned out in droves across the country in a determined bid to oust Najib.
Najib's defeat could be just the start of his problems -- 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.
In Mahathir, the opposition found the perfect person to take on Najib. He is a staunch Malay nationalist 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.