Malaysian opposition icon Anwar Ibrahim kisses his wife, Wan Azizah Ismail, during a news conference in Kuala Lumpur after his release Wednesday. (Lai Seng Sin/Reuters)

Anwar Ibrahim, the standard-bearer of Malaysia’s reform movement, was released from prison and granted a royal pardon Wednesday in one of the most dramatic developments since an opposition alliance scored a stunning win in national elections last week.

Anwar, 70, was convicted in 2015 of sodomy in a case that he maintained was trumped up to crush his opposition movement. Supporters chanted “Reformasi” (Reform) as he walked free before being whisked to the royal palace to meet the king, news agencies reported.

His release reunites him with a man who was once his ally and mentor, then his bitter enemy, and is now his ally again: Prime Minister Mahathir Mohamad, 92, who returned to power last week at the head of the opposition alliance.

Anwar served as Mahathir’s deputy and finance minister in the 1990s before falling out with him during the Asian financial crisis, being sacked from the government and forming the Reformasi movement.

Within weeks, Mahathir had him jailed on charges of sodomy and corruption. A second jail term followed in 2015 under Prime Minister Najib Razak, who lost last week’s election and faces a corruption investigation. The Associated Press reported that police searched Najib’s house late Wednesday, apparently seeking documents as part of the probe.

How Mahathir and Anwar will get along, along with whether and when the prime minister will stand aside for the man who built the opposition alliance, is one of the biggest questions facing Malaysia.

For now, Anwar, whose wife, Wan Azizah Ismail, is the new deputy prime minister, says he wants to spend time with his family, rest and carry out some speaking engagements. He insists he is in no hurry to take a spot in the cabinet or take over as premier.

On Wednesday, Anwar called his release a victory for all Malaysians, regardless of race or religion, who stood by the principles of democracy and freedom.

“When you are incarcerated, you realize what is the meaning and significance of freedom,” he told reporters outside his house in Kuala Lumpur. “There is a new dawn for Malaysia.”

He thanked Mahathir for his help in getting him released and pardoned, the latter a critical step in allowing Anwar to return to politics.

“I and Mahathir have buried the hatchet already. It was a long time ago,” he said, his tie and jacket off and sleeves rolled up after he returned from the palace, news agencies reported.

“I have forgiven him. He has proven his mettle. Why should I harbor any malice toward him?” Anwar said. “My position is to give him all the support necessary to allow him to ensure the agenda for reform, the changes that need to be done, can be made.”

During the campaign, Mahathir promised to stand aside for Anwar once he had been pardoned, but the veteran leader is now talking of running the country “for one or two years” to fix its financial problems.

Anwar’s first trial in 1998 was a dramatic affair, with the man who had only just been dismissed as deputy premier appearing in court with a black eye and bruises, sparking international condemnation of Mahathir. At one point, prosecutors produced a mattress that they said was stained with semen, accusing Anwar of having sex with two male aides. Anwar was convicted and sentenced to prison. In 2014, he was again convicted of sodomy in a separate case during the Najib administration. An appeal was rejected and his prison sentence upheld in 2015.

Amnesty International said Anwar’s release was a “landmark moment for human rights” in Malaysia and called for the repeal of repressive laws muzzling freedom of expression and assembly, the Associated Press reported.