Forced medical examinations for homosexual men have been banned by Tunisia’s medical council.
Same sex relationships are banned in the north African country, where doctors perform anal "tests" people suspected of engaging in them.
But the National Council of the Medical Order has now decreed that doctors must tell people they have a right to refuse the exams.
Human Rights Watch (HRW) said the announcement, made earlier this month, was an “important” and “courageous” step forward.
However, it said that people could still feel compelled to give their "consent" in some circumstances. Campaigners have said the tests can amount to torture.
“Tunisian doctors have taken a courageous step in opposing the use of these torturous exams,” said Neela Ghoshal, senior LGBT rights researcher at HRW.
“To ensure that forced anal testing in Tunisia ends once and for all, police should stop ordering the exams, and courts should refuse to admit the results into evidence.”
However, others argued more action was needed.
"Although the decision of the Tunisian medical council to oppose coercive anal tests is a welcome move, it does not go far enough,” said Peter Tatchell, LGBT rights campaigner.
“Anal tests for homosexuality, regardless of whether they forced or with consent, are unreliable and unethical. They are rightly condemned by medical authorities worldwide."
In Tunisia the tests have been going on for at least nine years and most probably longer.
“Damj [Tunisian LGBT rights group] said they were already hearing of cases when they first started documenting human rights abuses in 2008, and they didn't know how far back the practice dated,” Ms Ghoshal told The Independent.
“Because they were working more or less underground at the time, not much was publicised about these abuses.”
However, a series of high profile cases in Tunisia in recent years has brought more attention to the issue.
Two men were arrested in December last year and subjected to the tests. Despite ‘passing’ the exam both were sentenced to eight months in prison in March.
Earlier HRW reports also documented a number of other cases of men being subject to the abuse in 2015.
“I took my pants off and had to get on the table,” one man told the charity. “He entered one finger inside my anus, with cream on it. He put his finger in and was looking. While putting his finger in, he said, ‘Are you ok now’, I said, ‘No I’m not okay.’ It was painful.
“Then he put in a tube. It was to see if there was sperm. He pushed the tube far inside. It was about the length of a finger. It felt painful. I felt like I was an animal, because I felt like I didn’t have any respect. I felt like they were violating me.”
HRW and other rights groups have been lobbying the medical council since 2015 but it was not immediately clear what prompted the announcement.
However, HRW welcomed the development and hoped it would inspire change in other places.
“It is time for the world to say a resounding no to the use of forced anal exams everywhere,” Ms Ghoshal said.
“It is encouraging to see Tunisia’s doctors leading the way. Medical councils around the world, as well as law enforcement agencies and other government bodies, should take their cue from this example.”