A Tunisian man has been sentenced to six months in prison on charges of homosexual conduct, after he reported being raped and assaulted by two thieves.

The man – identified only as Anas – reported his assault to a police station in the coastal city of Sfax on 2 January, but following initial questioning the 22 year-old was accused of homosexuality, a crime punishable by up to three years in prison.

He was subsequently subjected to an enforced anal examination, an unscientific and invasive procedure prohibited by international law. Although the results came back negative, Anas was still remanded in custody until his trial.

Both of the men accused of attacking Anas yesterday received sentences of six months for homosexuality, with a further two months for physical assault and theft. However, after falsely alleging that Anas had consented to sexual relations, the court ruled that he would also serve time in prison.

Mounir Baatour, a lawyer who has been involved in the case, told the Independent that Anas’ friends and family were still struggling to reconcile themselves to the court’s ruling.

“His mother has been very affected,” he said: “She does not stop crying. His friends are all angry.”

Baatour confirmed that Anas plans to appeal the ruling; an online petition calling for his release has also been launched.

READ: Arrest of Tunisia nurse who raped dozens of patients

Anal examinations are a common practice in some parts of the Arab world, where rape victims or men accused of same-sex relations are penetrated with an object to determine whether they “habitually” engage in anal sex.

Same-sex relations are illegal under Article 230 of Tunisia’s penal code but, in April 2017, Tunisia’s National Council of the Medical Order announced that doctors must inform people accused of sodomy of their right to refuse the anal examination. Later that year, Tunisia also pledged to the UN Human Rights Council that it would end anal examinations, but there is little evidence to suggest much action has been taken to prohibit the practice.

The ruling was condemned by Human Rights Watch (HRW), who called on the Tunisian government to support Anas as a victim of sexual assault.

“Tunisia should uphold its commitment to human rights and stop subjecting its citizens to such brutal indignities. Tunisia’s presidential commission on individual freedoms has called for the repeal of Article 230 and a prohibition on forced anal exams. President Beji Caid Essebsi has maintained silence on the matter,” a HRW statement read.

“[Essebsi] should stand up for sexual assault victims like A.F. [Anas] and for the privacy rights of all Tunisians,” the statement concluded.

READ: Jordan MP calls for rapists to be pardoned