Police in Uganda have charged 20 LGBT people with disobeying rules on physical distancing and risking the spread of coronavirus, in what campaigners say is a clear case of authorities in parts of Africa abusing newly imposed restrictions to target sexual minorities.

Fourteen gay men, two bisexual men and four transgender women were taken into custody on Sunday when police raided a shelter on the outskirts of Uganda’s capital, Kampala.

A police spokesperson, Patrick Onyango, said the detainees had been disobeying distancing rules by “congesting in a school-like dormitory setting within a small house” despite a ban at the time on gatherings of more than 10 people, since reduced to five.

Onyango denied allegations made by LGBT campaigners that they were targeted because of their sexual orientation. “We still have offences of unnatural sex in our law books,” Onyango told Reuters. “We would charge them with that law, but we are charging them with those counts, as you can see.”

Frank Mugisha, the executive director of Sexual Minorities Uganda, said the arrests were “a clear case of discrimination” against the LGBT community. He said the raid followed complaints to police about the shelter from neighbours, and the lockdown-related charges were brought only when it was clear that there was no other justification for holding the detainees .

“The arrests were initially around homophobia and transphobia because neighbours reported them and so the security forces came and raided them. These people were at home and they all know each other,” Mugisha said. “Now they are putting them in prison where they will be more at risk.”

Activists in Uganda said the pandemic had contributed to a rise in homophobic rhetoric in Uganda, with the LGBT community being blamed by some for the disease.

Homosexuality is illegal in most countries on the African continent. In a handful of states, gay people can face life imprisonment or the death penalty. In Uganda, a largely conservative Christian country, homosexual sex is punishable by life imprisonment.

The Refugee Coalition of East Africa, which represents a number of LGBT refugee organisations in the region, said in a statement last month: “We are in the midst of a public health emergency causing panic, death and fear on an international and widespread level. It merits the attention of the world and its leaders. [But] at the same time, we implore humankind to not let us slip from your consciousness.”

The two charges against the group in Uganda – disobeying a lawful order and committing neglectful acts likely to spread infection of disease – carry a maximum of two and seven years imprisonment respectively.

Uganda announced its first coronavirus case on 21 March and now has 33 confirmed cases.