A Ugandan court has sentenced a man to 30 years in jail for the brutal slaying of a leading gay rights activist, a spokeswoman for the public prosecutor said Friday.

Enoch Nsubuga admitted beating prominent campaigner David Kato to death with a hammer at his home outside Kampala in January, but claimed that he had been reacting to unwanted demands for sex.

"He was convicted and on Thursday given 30 years in prison," Jane Okuo Kajuga, a spokeswoman for the Directorate of Public Prosecutions, told AFP.

The killing drew worldwide condemnation, coming after a newspaper in Kampala had published a picture of Kato alongside a headline demanding that homosexuals be hanged.

A controversial bill that calls for the death penalty for certain homosexual acts was recently re-introduced in the Ugandan parliament after lawmakers failed to debate it during the last session of the legislative body.

Homosexuality is illegal in Uganda and in some circumstances punishable by long prison sentences, but the proposed legislation envisions stiffer punishments, including the death penalty for "repeat offenders."