Uganda's constitutional court on Friday overturned an anti-homosexuality law that punished gay sex with long prison sentences and which drew stern criticism from Western and other donors, some of whom withheld aid.

The new ruling, which can be appealed, voids a statute signed into law by the president in February and which has broad public support in the religiously conservative African nation.

Under the Anti-Homosexuality Act, those convicted of "aggravated homosexuality" — defined as someone with HIV having gay sex or gay sex with anyone vulnerable, such as a disabled person — were put in prison for life.