A Ugandan court has ordered a newspaper that called for homosexual people to be hanged to stop publishing the names and photographs of people it said were gay.

The order was granted a day after Rolling Stone, a new weekly tabloid, printed pictures of about 20 men described as "generals" of the gay community in Uganda. The headline was Men of Shame Part II, and followed the publication of a list of 100 allegedly gay people last month.

Several of the people in the original list reported facing harassment, including a woman who was forced to flee her home after neighbours pelted it with stones. Anti-gay sentiment in Uganda has been fuelled by the campaign by politicians and evangelical preachers to pass a law that would see gay people face life imprisonment or even the death penalty.

The temporary injunction was granted following an application by Sexual Minorities Uganda, a pressure group. The high court judge Vincent Musoke-Kibuuka said the paper's anti-gay campaign was an "invasion of the right to privacy".

Frank Mugisha, the chairman of Sexual Minorities Uganda, said his organisation would seek damages from Rolling Stone if the judge ruled against the paper in the next hearing on 23 November.

"Justice has been served. This should be a reminder to the media not to incite violence against minority groups in this country," Mugisha said.

Uganda's media, which is very aware of the political lines that should not be crossed, has been encouraged by a very lax attitude to regulation when it comes to issues of homosexuality, which is widely disapproved of in the country.

Other tabloids, such as Red Pepper, have outed gay people several times in recent years. Rolling Stone, which has a circulation of around 2,000, was launched in August by graduates of Kampala's Makerere University, a favourite destination of Christian preachers behind the anti-gay crusade.

While Rolling Stone's editors did run into trouble with the Uganda Media Council after the "Hang Them" front page in early October, it was not due to the content, but rather a registration issue. Paul Mukasa, the council secretary, said today that he was not aware of the court injunction, but confirmed that the paper had not been cleared to resume publication. He said: "We will take a look at this and see if action needs to be taken."

Giles Muhame, Rolling Stone's managing editor, said he was taking legal advice on whether to challenge the injunction. "We have already achieved our objective: to show the world that homosexuality is spreading like wildfire in Uganda."