Former Malaysian Deputy Prime Minister Anwar Ibrahim, who was jailed for sodomy, was released on Wednesday after newly elected Prime Minister Mahathir Mohamad helped arrange a full pardon for him.

Anwar, 70, headed for the royal palace to meet the King after the pardon came through, Xinhua news agency reported.

He emerged from Cheras rehabilitation hospital here where he was serving his sentence after an operation on his shoulder.

Once seen as a potential future leader, he had been jailed on charges of sodomy and corruption after falling out with the government.

Mahathir has promised to step aside for Anwar to become Prime Minister within two years.

Also read | Mahathir Mohamad becomes Prime Minister of Malaysia

At the age of 92, Mahathir Mohamad, was elected as the new Malaysian Prime Minister after a stunning election victory against scandal-haunted leader Najib Razak.

Mahathir Mohamad became the world’s oldest Prime Minister after a stunning election victory against scandal-haunted leader Najib Razak.

Mohamad’s win overturned decades of dominance by the country’s main coalition, Barisan Nasional (BN), which had been in power since independence in 1957.

Also read | PM Modi congratulates Mahathir Mohamad on being sworn in as Malaysian PM

He came out of retirement and defected to the opposition to take on and beat Najib Razak.

Official results showed that the opposition alliance Pakatan Harapan (Alliance of Hope) won 113 of total 222 seats — crossing the required majority of 112 — while the ruling BN coalition of Najib managed to get just 79 seats.

The Malaysian Islamic Party (PAS) emerged as the third biggest force with 18 seats.

Mahathir, was the longest-serving Prime Minister of the country between 1981-2003. Under his leadership, Malaysia became one of the Asian tigers — the group of countries which saw their economies expand rapidly in the 1990s.

(With agency inputs)