KAMPALA, Uganda (AP) -- A Ugandan court on Friday invalidated an anti-gay bill signed into law earlier this year, pleasing activists and watchdog groups who called the measure draconian and wanted it repealed.
The Constitutional Court declared the law illegal because it was passed during a parliamentary session that lacked a quorum.
Activists erupted in cheers after the court ruled the law "null and void," but some cautioned that the fight was not over: The state could appeal the ruling in the Supreme Court and legislators might try to reintroduce new anti-gay measures. Also, a colonial-era law that criminalizes sex acts "against the order of nature" still remains in effect in Uganda, allowing for continued arrests.
The invalidated law provided jail terms of up to life for those convicted of engaging in gay sex. It also allowed lengthy jail terms for those convicted of the offenses of "attempted homosexuality" as well as "promotion of homosexuality."
Although the legislation has wide support in Uganda, it has been condemned in the West.
The U.S. has withheld or redirected funding to some Ugandan institutions accused of involvement in rights abuses, but the ruling Friday might win the Ugandan delegation a softer landing in the U.S. next week as it heads to Washington for a gathering led by President Barack Obama.
The panel of five judges on the East African country's Constitutional Court said the speaker of parliament acted illegally when she allowed a vote on the measure despite at least three objections -- including from the country's prime minister -- over a lack of a quorum when the bill was passed on Dec. 20.
"The speaker was obliged to ensure that there was a quorum," the court said in its ruling. "We come to the conclusion that she acted illegally."
The courtroom was packed with Ugandans opposing or supporting the measure.
Frank Mugisha, a Ugandan gay leader, said the ruling was a "step forward" for gay rights even though he was concerned about possible retaliation.
Ugandan lawyer Ladislaus Rwakafuuzi, an attorney for the activists, said the ruling "upholds the rule of law and constitutionalism in Uganda."
U.N. Secretary-General Ban Ki-moon welcomed the decision as a "victory for the rule of law," according to a statement read by U.N. spokesman Stephane Dujarric. "He pays tribute to all those who contributed to this step forward, particularly the human rights activists in Uganda who spoke out at great personal risk."
Lawyers and activists challenged the anti-gay law after it was enacted in February on the grounds that it was illegally passed and that it violated certain rights guaranteed in Uganda's constitution.
The court ruled Friday that the activists' entire petition had been disposed of since the law was illegally passed in the first place. This means there will be no further hearings about the activists' argument that the anti-gay measure discriminated against some Ugandans in violation of the constitution.
Nicholas Opiyo, a Ugandan lawyer who was among the petitioners, welcomed the ruling but said there is a missed opportunity to debate the substance of the law. "The ideal situation would have been to deal with the other issues of the law, to sort out this thing once and for all," Opiyo said.
He mentioned the existing law that still allows for arrests of alleged offenders. Lawmakers might also try to reintroduce a new anti-gay measure, he said.
Kosia Kasibayo, a state attorney, said a decision had not been made on whether to appeal the ruling in the Supreme Court, Uganda's highest court.
The anti-gay legislation was enacted on Feb. 24 by Ugandan President Yoweri Museveni, who said he wanted to deter Western groups from promoting homosexuality among African children.
Some European countries and the World Bank withheld aid over the law, piling pressure on Uganda's government, which depends on Western support to implement a substantial part of its budget. Ofwono Opondo, a Ugandan government spokesman, had repeatedly described Western action over the law as "blackmail." Opondo and other government officials were not immediately available for comment after the Friday ruling.
Supporters of the anti-gay measure say they believe Museveni -- who will lead Uganda's delegation to the U.S. next week-- may have quietly backed the court's ruling. Many Ugandans see the courts as lacking independence and unlikely to make decisions strongly opposed by Museveni, who has held power here for nearly three decades.
"This ruling has got nothing to do with the will of the people," said Martin Ssempa, a prominent Ugandan cleric who has led street marches in support of the anti-gay measure. "Unfortunately, it has everything to do with pressure from Barack Obama and the homosexuals of Europe."