KUALA LUMPUR — Malaysia’s new prime minister, Mahathir Mohamad, said on Friday that the country’s king had agreed to pardon the imprisoned opposition leader Anwar Ibrahim, potentially clearing the way for fulfilling one of the central pledges of Mr. Mahathir’s campaign this year.
The announcement is the latest turnaround in an election that has upended Malaysian politics. Mr. Mahathir, who also served as prime minister from 1981 to 2003, led a coalition of opposition parties to defeat Prime Minister Najib Razak, his former protégé, who has been accused of large-scale corruption.
The opposition victory ended a grip on power for Mr. Mahathir’s former party, the United Malays National Organization, that dated to the country’s independence from Britain in 1957.
Mr. Anwar was convicted on corruption and sodomy charges and sentenced to prison in 1999 in a case that was widely seen both as politically motivated and as happening at Mr. Mahathir’s direction.
That Mr. Mahathir and Mr. Anwar now find themselves on the same side again is a measure of the opposition’s urgency to oust Mr. Najib. And more: Mr. Mahathir has said he would be willing to step aside and clear the way for Mr. Anwar to become prime minister.
“Many of them suffered during his time as prime minister,” Ibrahim Suffian, executive director of the Merdeka Center, an independent survey group, said of Mr. Mahathir’s new allies. But, he added: “In the last couple years they found Mahathir to be a solid politician with deep grasp of gamesmanship required to win. They couldn’t get here without Mahathir, and they’re not about to abandon him.”
Mr. Anwar is now serving a second prison term that nominally ends in June.
The king indicated “he is willing to pardon Datuk Seri Anwar immediately, so we will go through the proper process of obtaining a pardon,” Mr. Mahathir said Friday at a news conference, using an honorific.
With Mr. Mahathir as he spoke was Mr. Anwar’s wife, Wan Azizah Wan Ismail, who will be the next deputy prime minister.
Mr. Mahathir did not give any indication of when a pardon of Mr. Anwar might occur, but said that once free, he should be able to return to political life.
“It is going to be a full pardon, which of course means he should not only be pardoned, he should be released immediately when he is pardoned,” Mr. Mahathir said. “After that he will be free to participate fully in politics.”
Mr. Mahathir also said his new government intended to look into allegations of electoral fraud.
“In the last two days there weren’t any speeches made, only monies distributed,” he said. “We will properly investigate all these things.”
He said the government would also review the performance of the country’s anti-corruption commission and whether it had shown deference to any political parties.
“Our intention is to go for people who have shown a tendency to be corrupt or had committed known crimes,” Mr. Mahathir said when asked about an investigation into billions of dollars missing from 1Malaysia Development Berhad, the government investment fund that Mr. Najib once led.
The opposition’s victory was the result of an alliance of former rivals, including Mr. Mahathir and people who have opposed him and his former party. They were unified primarily by their disdain for Mr. Najib, and his ouster raises questions about whether such cooperation will continue.
Politicians who were until days ago members of the opposition say they expect the alliance to hold.
Tony Pua, a member of Parliament from the Democratic Action Party, said that unlike in the past, when Mr. Mahathir’s party dominated the governing coalition, his party is no longer the strongest.
“Consensus is required, and the experience working with him over the past six months certainly confirms he is more than able to make decisions consensually,” Mr. Pua said.
Mr. Ibrahim of the Merdeka Center noted that Mr. Mahathir also gives the new governing coalition a leader with the trust of the bureaucracy and the ethnic Malays who make up a majority of the population.
“There is just enough trust as well as pragmatism to keep the coalition together in the near term,” Mr. Ibrahim said. “One reason is the size of the victory. They nearly achieved half of the popular vote. It is not a slim majority.”
Sharon Tan contributed reporting.