Baabou told Al-Monitor that the doctor who examined A.F. was known to pronounce alleged "homosexuals" as "straight" and had reportedly done so in the latter’s case as well, making the verdict against him all the more unjust. Police seized A.F’s cellphone, which violates the country’s revamped privacy laws, and scoured through his Facebook and other social media messages to incriminate him, a pattern repeated time and again by the police, Baabou observed.

A.F. was subjected to a forced anal examination at a local hospital, supposedly to assess whether he had engaged in same-sex relations or not. The practice involves doctors penetrating individuals with their fingers.

Badr Baabou runs the Tunisian Association for Justice and Equality, or DAMJ, the country’s oldest grass-roots lobby group for the LGBT community . He called the affair a “legal scandal” and described the evidence used against A.F. as a “total sham.” Baabou said supporters would appeal the verdict against A.F. today.

The court sentenced A.F.'s assailants to six months under the same law and to an additional two months for robbery and assault. A.F. later retracted his claim of rape, presumably to avoid imprisonment, but he was still sentenced.

The case of a Tunisian man who told authorities he was gang raped only to end up behind bars has refocused attention on the continued harassment of individuals based on sexual orientation in Tunisia. The 22-year-old, known by his initials A.F., had sought police assistance in the southern Tunisian town of Sfax in January. He was promptly arrested on charges of homosexual conduct. Yesterday, A.F. was sentenced to six months in prison for violating Article 230 of Tunisia’s penal code, which proscribes same-sex relations.

Tunisia told the United Nations Human Rights Council in September 2017 that it would end anal testing. But it did so with a caveat. Medical examinations would be consensual and carried out in the presence of a medical expert.

Human Rights Watch described the procedure as “highly unreliable” and said it constituted “cruel, degrading and inhuman treatment that can rise to the level of torture.”

However, an openly gay businessman from the southern city of Djerba, who declined to be identified by name, told Al-Monitor, “Things are not so bad for homosexuals in Tunisia,” and even less so in the capital Tunis and at tourist resorts in Hammamet and Sousse. In Tunis, for example, Yuka, a popular gay-friendly club, operates unhindered. Harassment of the LGBT community, the man insisted, was limited to homophobic police “abusing their power, much as they did before the [2011 Jasmine Revolution]." As for bisexuality, he said, "it's everywhere." He credited modern Tunisia’s determinedly pro-secular founding dictator, Habib Bourguiba, and his embrace of French law, for a “relatively tolerant environment unmatched in the rest of the Arab world.”

Mounir Baatour, president of Shams, another prominent advocacy group, had a darker view. Homophobic attacks, he said, remained depressingly common. He receives death threats via the organization’s Facebook page every day.

"I have reported the threats to the police and they have done absolutely nothing about it,” Baatour, a French-trained lawyer, told Al-Monitor.

Baabou said his organization was aware of at least 22 violent assaults against gay individuals last year. Last year, DAMJ’s office was broken into, its laptops stolen — an unresolved crime that “may well have been committed by police.”

Baatour said he had “no hope” that things would change anytime soon, nor that Article 230 would be repealed, “because the Islamists are in power.” He was referring to the Ennahda party, which shares power with secularists in an increasingly shaky cohabitation deal that was struck in 2014. Islamic conservatives publicly condemn same-sex relations; yet, so long as they are not openly advertised, they are tolerated and Tunisia's Islamists and secularists can sometimes switch roles.

The only Jewish minister in the Cabinet, Rene Trabelsi, is a member of Ennahda.

The country’s president, Beji Caid Essebsi, an old-style secularist, famously claimed that same-sex relations would be legalized “over my dead body.” Rachid Ghannouchi, the Ennahda leader, on the other hand, has pronounced himself neither categorically against nor for Article 230, saying that people’s sexual preferences should remain a “private matter.”

Yet, in June 2018, the Individual Freedoms and Equality Committee, a body appointed by Essebsi, proposed decriminalizing same-sex relations. In October, some 14 lawmakers tabled draft legislation that would scrap capital punishment and Article 230, among other things. It has yet to be adopted.

Meanwhile, in neighboring Algeria, a 20-year-old medical student was murdered Sunday in an apparently homophobic attack in Algiers. Assil Belalta was discovered in his university dorm room in a pool of blood with his throat slit. The words “he is gay” were allegedly scrawled on the wall with his blood, ObservAlgerie reported.