By Rozanna Latiff and A. Ananthalakshmi
KUALA LUMPUR (Reuters) - Mahathir Mohamad will be sworn in as Malaysia's seventh prime minister on Thursday, palace officials said, following his shock election victory over the coalition that has ruled the Southeast Asian nation for six decades since independence from Britain.
The monarch will swear in Mahathir as prime minister at 2130 hours (1330 GMT), a statement from the office of Malaysia's king, Sultan Muhammad V, said.
"His Majesty strongly supports and respects the democratic process and the wishes of his subjects," it added, and dismissed allegations that appointment was delayed.
Hundreds of Malaysians were lined up on the road leading to the palace, waving party flags and cheering the 92-year-old Mahathir.
"There is an urgency here, we need to form the government now, today," Mahathir told a news conference earlier in the day, where he insisted that he would be sworn in on Thursday.
Mahathir ruled Malaysia with an iron fist from 1981 to 2003 and now, with a second innings at the age of 92, is set to become the oldest elected leader in the world.
His alliance of four parties trounced the Barisan Nasional (BN) coalition of Prime Minister Najib Razak, who was once Mahathir's protege but became his most bitter rival.
Earlier on Thursday, Najib appeared to raise doubts that Mahathir would immediately take office because no single party had won a simple majority of seats in the 222-member parliament, and it would be up to the monarch to decide.
Official results showed that Mahathir's coalition won 113 seats, one more than the number required to rule. But it has not been formally registered as an alliance.
In jubilant mood and cracking jokes, Mahathir dismissed any doubts he would be prime minister. "I got up late, lots of people got up late," he replied when asked why there was a delay in swearing him in, noting that the election result was only officially announced around 5 a.m.
He said he had been assured of support from a raft of parties that would give his government 135 members of parliament.
Malaysian markets were closed and will reopen only on Monday, but overseas investors were nervous about the ouster of Najib, who has been in power for nearly a decade. The ringgit lost four percent in offshore trading, while an overseas Malaysian equity fund showed a 6 percent drop in share values.
"This upset ranks up there with Brexit and the Trump election," said Aninda Mitra, a senior sovereign analyst at BNY Mellon Investment Management. "I believe the ringgit will come under pressure as policy continuity will come under a cloud."
The Malaysian central bank held its regular policy meeting as scheduled on Thursday, and kept the key overnight interest rate unchanged at 3.25 percent. The date for the meeting had been decided before the election was announced.
Mahathir repeated a promise to repeal a goods and services tax (GST) introduced by Najib and review foreign investments, including major infrastructure projects that are part of China's Belt and Road initiative.
Global ratings agency Moody's said some of his campaign promises, including scrapping GST and a reintroduction of fuel subsidies, could be credit-negative for Malaysia's sovereign debt rating.
Najib's BN coalition won 79 seats, a collapse from the 133 it won in the 2013 election, which was itself the coalition's worst poll performance ever at the time.
Few had expected Mahathir to prevail against a coalition that has long relied on the support of the country's ethnic-Malay majority.
However, he joined hands with jailed political leader Anwar Ibrahim, his one-time deputy he famously fell out with in 1998, and together their alliance exploited public disenchantment over the cost of living and a multi-billion-dollar scandal that has dogged Najib since 2015.
"This election has proved to us that we moved beyond racial politics," said Khoo Ying Hooi, a professor of international and strategic studies at the University of Malaya. "It's really people power through the ballot."
Mahathir said that one of his first actions would be to seek a royal pardon for Anwar. Before the poll he had promised to step aside once Anwar was free and let him become prime minister.
His wife, Wan Azizah Wan Ismail, was sitting next to Mahathir at the news conference. Under an agreement with Mahathir, she is to be deputy prime minister.
Anwar was imprisoned, first by Mahathir on charges of corruption and sodomy. He was released in 2004 but jailed again by Najib in 2015.
Mahathir and Najib were once allies but they clashed over a scandal around 1Malaysia Development Berhad (1MDB), a state fund from which billions of dollars were allegedly siphoned off.
The 1MDB affair is being investigated by at least six countries, although Najib has denied any wrongdoing and has been cleared by Malaysia's attorney-general.
Mahathir had vowed to investigate the scandal if elected and bring missing funds back to Malaysia. On Thursday he said that if Najib had done anything wrong he would "face the consequences".
(Additional reporting by Joseph Sipalan, Emily Chow, Praveen Menon, Fathin Ungku and Liz Lee; Writing by John Chalmers; Editing by Raju Gopalakrishnan)