KUALA LUMPUR, May 16 (Reuters) .
Jailed Malaysian reformist Anwar Ibrahim was granted a full pardon on Wednesday and walked out of a hospital in Kuala Lumpur just a week after his alliance scored a shock victory in a general election.
Smiling and waving to supporters, Anwar, dressed in a black suit and tie and his hair neatly swept back, was surrounded by his family, lawyers and prison guards before driving to the palace for an audience with King Sultan Muhammad V.
He was greeted at the palace by new Prime Minister Mahathir Mohamad, his ally-turned-foe-turned-ally, with whom he joined forces to oust scandal-tainted Najib Razak's administration in last week's election.
"The king, with the advice of the pardons board of the federal territories of Kuala Lumpur, Labuan and Putrajaya, has allowed a full pardon and given an immediate release for ... Anwar bin Ibrahim," said a statement issued by the palace.
Anwar, 70, serving a five year-sentence for sodomy, has been recovering from a shoulder injury in hospital under police guard.
The pardon allows Anwar to re-enter active politics immediately, but it was not clear what his role in government would be.
Mahathir, 92, had vowed to enable Anwar's release and eventually step aside for him to become the prime minister.
On Tuesday, Mahathir said he expected to be prime minister for one or two more years, setting off talk of differences between the two.
"Seeing him walk free makes me emotional, but the fight is not over," said Ridzuan Ismail, an Anwar supporter at the hospital. "Now we need to see him become prime minister.”
Jack Seng, another supporter wearing a shirt with a logo of Anwar behind bars, said he thought Mahathir and Anwar would resolve any tensions between them.
"I think we need to let Mahathir do his work to save Malaysia and to get back its system of government."
Nurul Izzah, Anwar's daughter, said her father's release was a gift ahead of the holy Islamic month of Ramadan which begins on Thursday in Malaysia.
"A pardon based on a miscarriage of justice, a separation met with an eventual embrace," she said in an Instagram post. "We have got much to do, many more injustices to fight."
Anwar's freedom is expected to ease fears of a growing rift within the newly formed coalition government, after differences erupted between supporters of Mahathir and Anwar over cabinet positions and Anwar's role in the party.
Mahathir is the leader of the ruling alliance and Anwar's People's Justice Party (PKR) won the majority of parliamentary seats in the group.
The volatile relationship between Mahathir and Anwar has dominated Malaysia's political landscape for over three decades and is central to the future of the alliance