Uganda's constitutional court on Wednesday refused to annul or suspend an anti-LGBTQ law that includes the death penalty for certain same-sex acts, but found some of its provisions inconsistent with certain fundamental human rights.
The legislation, adopted in May last year, is among the world's harshest anti-gay laws and has drawn condemnation from rights campaigners and sanctions from Western nations.
Activists say the law has unleashed a torrent of abuse against LGBTQ people, including torture, rape, arrest and eviction.
"We decline to nullify the Anti-Homosexuality Act 2023 in its entirety, neither will we grant a permanent injunction against its enforcement," said lead judge Richard Buteera, reading the judgment on behalf of his four colleagues.
However, the court struck down certain sections it said were "inconsistent with right to health, privacy and freedom of religion".
In particular the court said the section of the legislation requiring the mandatory reporting to authorities of people suspected of having committed homosexual offences violated individual rights.
When the law was enacted in May 2023 the World Bank halted new lending to Uganda and the United States announced visa and travel restrictions against Ugandan officials.
The Anti-Homosexuality Act imposes penalties of up to life imprisonment for consensual same-sex relations and contains provisions that make "aggravated homosexuality" an offence punishable by death.
Petitioners against the law include a lawmaker and Frank Mugisha, Uganda's most prominent LGBTQ activist. They asked judges to strike the law down, saying it violated their constitutional rights.
The petitioners can appeal to the Supreme Court.
The ruling is part of a growing anti-gay crackdown across Africa. Ghana passed stringent anti-gay legislation in February, intensifying a crackdown on the rights of LGBTQ people.