At least eight countries allow tests where doctors penetrate men accused of being gay. The international community needs to stand up to this abuse.

“Kais” cannot forget the day last December when two police officers in Kairouan, Tunisia, forced him onto an examination table in a doctor’s office, one pushing him onto his knees and pulling down his trousers, the other holding his arms. Held down, Kais was helpless as a doctor forcibly inserted a finger — and then a tube — into his anus.

What Kais, 21, experienced was a form of sexual assault, pure and simple. But it was also a legally sanctioned procedure, designed to produce evidence to submit in court. The medical report by the doctor who forcibly sodomized Kais purported to demonstrate that Kais had previously engaged in anal sex, in violation of Tunisia’s sodomy law.

The type of examination that Kais was subjected to flies in the face of modern forensic medicine. Theories behind such tests date back to an 1857 treatise by the French doctor Augustin Ambroise Tardieu, who thought he could identify signs of “habitual pederasty,” such as “funnel-shaped deformation of the anus” and the “relaxation of the sphincter.”

Though his theories were quickly invalidated by the European medical profession, they were taken up elsewhere, serving the penal machinery of countries that criminalize same-sex conduct but find themselves at a loss to produce “evidence” when most arrests are based on rumors or mere suspicion. Our research has found that in the last five years, medical practitioners in at least eight countries — Cameroon, Egypt, Kenya, Lebanon, Tunisia, Turkmenistan, Uganda, and Zambia — have conducted such “tests” on men and transgender women accused of homosexual conduct.

Police, sometimes armed with a prosecutor’s order, take “suspects” to a forensic doctor or a general practitioner, who inserts fingers and sometimes objects into the anus to determine its “tone.” The exams, which the United Nations considers a form of torture or cruel, inhuman, and degrading treatment, typically result in a medical report that can be introduced in court as evidence.

In Tunisia, Kais and five of his friends were convicted and sentenced to three years in prison solely on the basis of medical reports from their anal examinations. On appeal, their sentence was reduced to one month, and they are now free — but they remain scarred by the humiliation and the brutality they experienced at the hands of both police and doctors. “I felt like I was an animal. I felt I wasn’t human,” Kais’s friend “Mehdi” said. Similarly, “Louis,” who underwent an anal exam in Cameroon in 2007, told us nine years later, “I still have nightmares about that examination.” (All names have been changed for victims’ protection.)

Anal testing has been roundly condemned by the Independent Forensic Experts Group, a group of 35 preeminent forensic doctors from around the world. The organization has stated that at least 15 medical conditions, ranging from constipation to Parkinson’s disease, can cause indications similar to those that some doctors see as signs of homosexuality, such as a loose anal sphincter. The group also says the exams violate medical ethics.

Even some doctors who conduct the exams have doubts about their validity. When I asked a Ugandan doctor what he is looking for when police bring him accused people to examine, he said,: “That’s the problem. What am I to check for? I just examine them because they’re being sent to me, but what they do in their bedrooms is not my business. ... I put on my gloves and check their anal area, but I really don’t find much.”

In some countries there is progress toward banning anal examinations. In 2012 doctors with the Lebanese Order of Physicians said they would no longer conduct the exams, which one Lebanese doctor referred to as “the biggest lie in the history of medicine.” Their bold action was followed by a Justice Ministry statement opposing the exams, although prosecutors occasionally still order them. In Tunisia the national medical council has said doctors should only conduct the exams with “consent.” But for Kais and his friends, “consent” entailed being taken handcuffed to a doctor, beaten by police, and ordered to sign a consent form. In Kenya and Uganda, activists are arguing before the courts that forced anal examinations violate constitutional rights to privacy, dignity, and freedom from torture and ill-treatment.

No one should be subjected to torturous and degrading examinations that are based on invalidated theories from 150 years ago. All countries permitting such “tests” should make it a priority to end them, in practice and on the books. The World Health Organization and other international agencies working on health, human rights, and related issues should stand up and condemn them in a strong and unified voice.