More than 70 gay men were jailed by Tunisian authorities last year, according to activists, who warn anal tests and phone searches are being used to identify suspects.

Mounir Baatour, lawyer and president of the Tunisian LGBT association Shams, said that while the 2011 revolution had given greater freedoms to civil society groups, this had been accompanied by a rise in discrimination. “When LGBT people started [speaking out] after the revolution, stigma and homophobia increased,” he said.

Shams recorded 71 prosecutions for homosexuality and sodomy in 2017, and a further 53 prosecutions so far in 2018. Under article 230 of the penal code, gay or lesbian sex is punishable by up to three years in prison.

Human Rights Watch and Shams said anal examinations to determine sexual orientation should be banned.

“The Tunisian authorities have no business meddling in people’s private sexual practices, brutalising and humiliating them under the guise of enforcing discriminatory laws,” said Amna Guellali, Tunisia’s director for HRW.

In June, a presidential commission, the individual freedoms and equality committee, proposed the decriminalisation of homosexuality. Last month, this proposal was included in draft legalisation put forward by members of parliament.

The draft legislation was welcomed as a breakthrough by LGBT rights campaigners, though it is feared the proposals are unlikely to gain support from conservative politicians.

“This is something big that we didn’t envisage years ago. But it doesn’t mean we will have a law,” said Guellali. “It is a step forward but there is still a lot of work to be done.”

Last week, HRW warned police are using anal tests and confiscating men’s phones to gather evidence for prosecutions. In 11 cases reviewed by the group, men were mistreated in police custody, forced to make confessions and denied access to legal counsel.

In one case, a 32-year-old man, known as KS, said he was gang-raped after meeting a man he had spoken to on Grindr. The man invited KS to his house, where he showed him a police badge. Two other men arrived, who beat and raped KS.

To receive medical treatment, he was required to file a complaint of gang-rape to the police. Instead of treating him as a victim, officers instead ordered an anal test to determine whether he was “used to practising sodomy”. Such tests are recognised by the UN as a cruel and degrading treatment which can amount to a practice of torture.

In September 2017, Tunisia’s minister for human rights, Mehdi Ben Gharbia, said the country would ban forced anal examinations to determine sexuality, but that suspects can still be asked to undergo a test. Campaigners say tests should be banned outright – including so-called consensual exams – since a refusal to comply can still be considered a sign of guilt by trial courts.