Makonda said he had put together a team of officials and police that would target gay people, who could face lengthy prison sentences.

On Sunday, national authorities issued a statement which, though it did not condemn the crackdown, did not condone the move. “The government of the United Republic of Tanzania would like to clarify that these are [Makonda’s] personal views and not the position of the government,” the foreign affairs ministry said in a statement.

Campaign groups have accused Tanzania of following a dangerous path. In May, 65 civil rights groups from across the world signed an open letter expressing deep concern over the decline in respect for human rights, including the rights to freedom of association, expression and peaceful assembly, in Tanzania.

Two opposition leaders were sentenced to five months in prison in February for insulting Magufuli, and an opposition leader was charged on Friday with sedition and inciting hatred, days after he said scores had died in clashes between security forces and herders in his western home district, a statement that was dismissed by authorities.

The LGBT community in Tanzania has faced repeated waves of repression. In 2016, Tanzania banned non-governmental organisations from distributing free lube to gay people as part of efforts to control the spread of HIV/Aids, even though some health experts warned shutting down such outreach programmes could put the wider population at higher risk of infection.

In a raid last year, at least 12 men were arrested at a Dar es Salaam hotel gathering that authorities said was to promote same-sex relationships.

Amnesty International has established that the men arrested last weekend were suspected of conducting a gay marriage because police found them sitting in pairs “two by two”.

“It is mind-boggling that the mere act of sitting in a pair can assume criminal proportions. The police clearly have no grounds to file charges against these men in court, despite arresting them three days ago,” said Seif Magango, Amnesty International’s deputy director for east Africa, the Horn and the Great Lakes.

A conviction for having “carnal knowledge of any person against the order of nature” can lead to 30 years or more in jail in Tanzania.

Homosexuality remains taboo across much of Africa and gay people face discrimination or persecution, with human rights groups often reluctant to speak publicly in defence of gay rights.

Six of the eight countries listed by campaigners as practicing anal examinations in 2016 were African: Tunisia, Egypt, Zambia, Kenya, Uganda and Cameroon.