* Anwar meets Mahathir, king at palace
* His relationship with Mahathir will set course for Malaysia
* Pardon allows Anwar to re-enter politics, but he wants time off
* I've forgiven Mahathir, Anwar says
Jailed Malaysian reformist Anwar Ibrahim was granted a full pardon and freed on Wednesday, capping dramatic changes in the Southeast Asian country since the government was ousted in an election upset last week.
The question for Malaysia now is how Anwar will get along with Prime Minister Mahathir Mohamad, his ally-turned-foe-turned-ally, and what role he will play in the new government.
Anwar, 70, said he would like to take time off with his family and did not intend to join the cabinet any time soon. He said he would support the government led by Mahathir and Deputy Prime Minister Wan Azizah Wan Ismail, who is Anwar's wife.
"I've told Tun Mahathir, I don't need to serve in the cabinet for now," Anwar said, using an honorific for the prime minister.
Anwar has been in hospital for some months, for surgery on a shoulder. But he looked in fine fettle as he walked free for the first time in three years, dressed in a black suit and tie, his hair neatly swept back.
Supporters chanted "Reformasi" (Reform), the movement he launched two decades ago to challenge diverse Malaysia's race- and patronage-based politics.
Anwar was sentenced in 2015 to a five-year term for sodomy, a charge he says was trumped up by the government of ousted Prime Minister Najib Razak.
Mahathir, with whom Anwar joined forces to win last Wednesday's election, greeted him at the palace where they both met the king.
Anwar was Mahathir's deputy in the 1990s but fell out with his mentor during the Asian financial crisis.
He was sacked from the ruling party and founded the Reformasi movement, challenging Mahathir's government. Within weeks, he was arrested and jailed on charges of sodomy and corruption.
Images at the time of a goateed, bespectacled Anwar in court with a black eye and bruises brought condemnation of Mahathir from around the world.
After being freed in 2004, Anwar was jailed a second time. Both times, he and his supporters have said the charges were politically motivated.
Anwar later told a news conference at his home he had forgiven the veteran leader, who was a pugnacious, uncompromising prime minister for 22 years from 1981.
"I and Mahathir have buried the hatchet already, it was a long time ago," Anwar said as he sat at a table under a marquee set up in the driveway of his home, his tie and jacket off and sleeves rolled up, after returning from the palace.
"I have forgiven him, he has proved his mettle. Why should I harbour any malice towards him?" Anwar said, speaking above supporters sounding their car horns and a tropical downpour.
The pardon, which enables Anwar to re-enter politics immediately, was granted on the grounds that there had been a miscarriage of justice.
'Fight not over'
Under a pre-election pact, Mahathir, 92, had vowed to enable Anwar's release and eventually step aside for him to become prime minister.
On Tuesday, Mahathir said he expected to be prime minister for one or two more years, setting off talk of fresh 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 an image of Anwar behind bars, said he thought Mahathir and Anwar would resolve any tension between them.
"I think we need to let Mahathir do his work to save Malaysia and to get back its system of government."
Differences have already cropped up between supporters of Mahathir and Anwar over cabinet positions and Anwar's role.
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 base case is that Mahathir passes the baton to Anwar. But Mahathir may be reluctant to hand over to his former nemesis, and if he drags his feet other scenarios could come into play," said Peter Mumford of the Eurasia Group in a research note.
Mahathir is also racing ahead with an investigation into graft at 1Malaysia Development Berhad (1MDB), a state fund founded by the ousted premier Najib that is sunk in a multi-billion-dollar graft scandal.
Mahathir has replaced the attorney-general and officials at the anti-graft agency, in what appears to be a purge of people seen as close to the former premier.
Najib and his wife, Rosmah Mansor, have been barred from leaving the country. Najib denies wrongdoing.
"It looks very likely that Najib will face the full force of the law," said Adib Zalkapli, a Kuala Lumpur-based analyst with risk consultancy Vriens & Partners.
"Just last week nobody would have thought that this posh boarding school boy would be rear ended by his old political headmaster," he said.
The prime minister of neighbouring Singapore, Lee Hsien Loong, will visit Mahathir on Saturday, Lee's office said.