A high court judge in Uganda has banned all media from outing gays and lesbians.
Judge Vincent Musoke-Kibuuke said lives were being put at risk by newspapers identifying people known or thought to be gay.
In October, Ugandan tabloid Rolling Stone – no relation to the US magazine – caused controversy by publishing the names, photos and addresses of people it accused of being gay and calling for them to be hanged.
At least four of those named were subsequently attacked, gay activists said.
Judge Musoke-Kibuuke granted a permanent injunction against Rolling Stone, ordering it not to publish the information again.
Lawyer John Francis Onyango, who represented the gay campaigners who brought the case against the newspaper, told AFP: “The judge granted a permanent injunction against Rolling Stone from publishing these names.
“But the ruling went beyond these applicants and extended to all media,” he added.
The three gay activists also received just over £400 each in damages.
The Civil Society Coalition on Human Rights and Constitutional Law in Uganda said that the ruling was a “landmark” and could help gays and lesbians in other homophobic countries by setting a precedent.
Speaking to the Guardian in October, Rolling Stone editor Giles Muhame defended his story, saying it was his duty as a journalist to “expose the evil in our society”.
Homosexuality is illegal in Uganda and a bill introduced in the country in 2009 called for life imprisonment and even execution for gay men and lesbians.
The current status of the bill is unclear. Reports said it had been quietly shelved, although other sources say it remains in the committee stage.