Uganda's constitutional court has overturned an anti-homosexuality law that was branded draconian and "abominable" by rights groups, saying it was wrongly passed by parliament.
The law is "null and void", presiding judge Steven Kavuma told the court on Friday, saying the process had contravened the constitution, as it has been passed in parliament in December without the necessary number of legislators.
Cheering gay rights activists celebrated the ruling, but supporters of the law said they would appeal at the Supreme Court.
"Justice prevailed, we won," said lawyer Nicholas Opiyo, who led the challenge in the constitutional court.
"The retrogressive anti-homosexuality act of Uganda has been struck down by the constitutional court - it's now dead as a door nail," said Andrew Mwenda, one of 10 petitioners.
The law, signed by Uganda's veteran President Yoweri Museveni in February, said that homosexuals should be jailed for life, outlawed the promotion of homosexuality, and obliged Ugandans to denounce gays to the authorities.
This is an important step in the right direction for human rights, not just of the LGBT community, but of all Ugandans.
US Secretary of State John Kerry likened the law to anti-Semitic legislation in Nazi Germany, and western nations made a raft of aid cuts to Uganda's government.
But homosexuality in Uganda remains illegal and punishable by jail sentences under previous legislation, which is expected to return after the court's decision.
Homosexuality is a taboo issue in much of Africa and is illegal in 37 countries on the continent. But the punishments laid out in Uganda were among the harshest.
The White House welcomed the court's decision.
"This is an important step in the right direction for human rights, not just of the LGBT [lesbian, gay, bisexual and transgender] community, but of all Ugandans," said Ned Price, a spokesman for the White House National Security Council.
UN Secretary-General Ban Ki-moon applauded Friday's court ruling, describing the decision as a "step forward" and a "victory for the rule of law".
The World Bank and some European donors - Norway, Denmark, and the Netherlands - withheld aid or loans worth more than $118m to Uganda. Uganda relies on aid to fund about 20 percent of its budget.