Anwar, the ruling party's rising star in the mid-1990s before he fell out with then Prime Minister Mahathir Mohamad, denied the charge that led to his second conviction for sodomy and said it was politically motivated.
"I will walk again for the third time into prison but rest assured that I will walk in with my head held high," Anwar said in a statement he read out in court. "I maintain my innocence. This to me is a complete fabrication coming from a political conspiracy to stop my political career.
"The charismatic Anwar, who heads a three-party opposition alliance, has for years been the greatest threat to Malaysia's political establishment.
A court found the 67-year old former deputy prime minister guilty in March last year of sodomising a former political aide. The conviction disqualifies him from political office and contesting the next election that must be held by 2018.
Hundreds of Anwar supporters, surrounded by dozens of police, earlier gathered outside the court in Kuala Lumpur waving party flags and shouting "Down with Barisan Nasional", referring to the coalition that has ruled since 1957.
The ruling may spark protests after opposition gains in a 2013 general election raised the possibility of a genuine challenge for the ruling coalition.
Human Rights Watch decried what it called Anwar's persecution. "Prime Minister Najib Razak's government has persisted in its politically-motivated prosecution of opposition leader Anwar Ibrahim at the expense of democratic freedoms and the rights to non-discrimination and privacy for all Malaysians," said Phil Robertson, deputy Asia director for the group. "Allowing this travesty of justice to stand will further undermine respect for rights and democracy in Malaysia."
Anwar was sacked in 1998 after falling out with then premier Mahathir and then campaigned against corruption and nepotism and led a nationwide "reformasi" (reform) protest movement. Since then, he has been beset by legal problems and spent several years in prison after being convicted of corruption and an earlier sodomy charge.
Some ruling party members and analysts have played down fear of upheaval in response to Anwar's return to jail. "Anwar's political image is not anywhere near close to what it was in the '90s," Wan Saiful Wan Jan, of the Institute for Democracy and Economic Affairs, said earlier. "The country has moved on."
Anwar's jailing could herald the disintegration of the three-party alliance he leads. It is paralysed with infighting and a meeting on Sunday to iron out differences and find a possible successor to Anwar was inconclusive.