0247 GMT September 17, 2019
Anwar, who was initially scheduled to be released on Tuesday, walked out of the Cheras Rehabilitation Hospital, where he was temporary confined after a surgery, and has arrived at the residence of the king, Yang di-Pertuan Agong Sultan Muhammad V, according to the Malaysian news website, The Star.
An image published by the Malaysian news agency Bernama showed Anwar greeting newly elected Prime Minister Mahathir Mohamad. Another image showed the king welcoming Anwar and his wife, Wan Azizah Wan Ismail, the deputy prime minister-designate.
Earlier, Mahathir arrived at the royal palace for the royal pardons board meeting to discuss Anwar's release.
Anwar's party PKR holds 48 seats of the 113 seats won by the Pakatan Harapan alliance on Wednesday, and he is widely tipped to succeed Mahathir once he steps down from office.
In 2015, Anwar, 70, was jailed for five years after being accused of sodomy, a charge he described as a politically motivated attempt by then Prime Minister Najib Razak to end his career.
Sodomy is illegal in Muslim-majority Malaysia, where the offence carries a jail term of up to 20 years.
Uder Malaysian law, unless he is pardoned by the king, Anwar would be disqualified for five years from running for office after his release.
Anwar was also imprisoned for six years after being overthrown as Mahathir's deputy prime minister in 1998 on earlier charges of sodomizing his former family driver and abusing his power.
He was freed in 2004 after Malaysia's top court quashed that sodomy conviction.
Anwar previously had a falling out with Mahathir after he criticized some of his policies. But his party eventually formed an alliance with Mahathir to take on Najib's United Malays National Organization (UMNO) for the election on Wednesday.
In recent weeks, Mahathir acknowledged the suffering of Anwar and his family.
"I know how Anwar feels. It was during my administration that he was sent to [prison]. It is not easy for him to accept me and shake my hand," The Malaysia Insight quoted Mahathir as saying.
"And it's not just Anwar but his family as well who felt pressure when he was jailed. They suffered for 20 years."