Kampala (AFP) - Uganda's constitutional court on Friday overturned tough new anti-gay laws that had been branded draconian and "abominable" by rights groups, saying they had been wrongly passed by parliament.
The legislation was signed by Uganda's veteran President Yoweri Museveni in February, recommending that homosexuals be jailed for life. It also outlawed the promotion of homosexuality and obliged Ugandans to denounce gays to the authorities.
The law is "null and void," presiding judge Steven Kavuma told the court, saying the process contravened the constitution, as it has been passed without the necessary quorum of lawmakers.
UN Secretary-General Ban Ki-moon described the decision as "a victory for the rule of law".
Ban paid tribute to "all those who contributed to this step forward, particularly the human rights defenders in Uganda who spoke out, at times incurring great personal risk," a statement from his spokesman said.
US Secretary of State John Kerry had previously likened the law to anti-Semitic legislation in Nazi Germany, and Western nations made a raft of aid cuts to Uganda's government.
Cheering gay rights activists celebrated Friday's ruling.
"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.
But homosexuality in Uganda remains illegal and punishable by jail sentences under previous legislation, which is expected to return after the court's decision.
- 'No longer criminal' -
Critics have said Museveni signed the law to win domestic support ahead of a presidential election scheduled for 2016, which will be his 30th year in power.
Government spokesman Ofwono Opondo said the law -- as it is on paper -- remains valid, saying it had been struck down on a matter of procedure and not over its content.
"The ruling has not nullified the anti-homosexuality law, it only ruled on the validity of the procedure in parliament," he said.
But gay rights activists were celebrating.
"I am no longer a criminal, today we have made history for generations to come," said Kasha Jacqueline, a petitioner and prominent gay rights activist.
"I am officially legal," said Frank Mugisha, another petitioner, but admitting despite his "celebration mood" the ruling was only the "beginning of a very long battle".
"The law has been struck on technicalities, so the big picture is still there," he said.
Lawmakers could seek to reintroduce a bill to parliament, a potentially lengthy process, with the last such bill taking four years from introduction to the final vote.
- 'Law is intact' -
David Bahati, the MP who introduced the bill -- which initially proposed the death penalty as punishment -- said he still backed the law.
"It is a setback but not a major one, because the law is intact," he told AFP.
"The law is good for Uganda, no matter what court decides."
Outspoken anti-gay preacher Pastor Martin Ssempa led prayers before the hearing inside the tightly packed courtroom calling for the judges to uphold the law.
Ssempa had already warned he feared the "judicial abortion of our bill" due to international pressure.
"We are determined to appeal this case at the Supreme Court," he said.
Ssempa said the petition had been pushed to polish Uganda's international reputation before Museveni travels to Washington next week to meet President Barack Obama at a US-Africa summit.
Rights groups, which said the law triggered a sharp increase in arrests and assaults of members of the country's lesbian, gay, bisexual and transgender community, welcomed the decision.
"We are pleased that this law cannot be enforced and entrench further abuses and discrimination," said Maria Burnett from Human Rights Watch.
"Even though Uganda's abominable anti-homosexuality act was scrapped on the basis of a technicality, it is a significant victory for Ugandan activists," Amnesty International said.
UNAIDS, the UN agency responsible for dealing with HIV and AIDS, called the ruling "a great day for social justice".
Homophobia is widespread in Uganda, where American-style evangelical Christianity is on the rise.
Gay men and women face frequent harassment and threats of violence.
The 10 petitioners -- including two Ugandan rights organisations -- had also claimed that the law violated the constitutional right to privacy and dignity, as well as the right to be free from discrimination, and cruel, inhuman and degrading treatment.
But the judges stuck down the law based on only the first section, the issue of quorum, before any of those issues were discussed.