Here’s something that doesn’t work: inspecting a man’s anus to determine if he’s homosexual. Not only does human anatomy simply not work that way, forced anal examinations are humiliating, intrusive, and akin to torture. And yet, eight countries are known to still do it.

Today, Kenya took a step toward abolishing the horrific “tests,” as a court heard a constitutional challenge to the practice. Although the results were inconclusive, the court signaled that the abhorrent practice’s days may be numbered.

Neela Ghoshal, a Nairobi-based activist for Human Rights Watch, told The Daily Beast that “it’s hard to imagine how a practice that has been harshly condemned by the UN Special Rapporteur on Torture can continue to be authorized in Kenya.”

Indeed, it’s clear that forced anal examinations are primarily about humiliation, not investigation. They date to the 19th century, when authorities tried to determine whether men suspected of homosexuality had engaged in anal sex or not. However, they have long been disavowed by all major medical associations. They only reveal whether there has recently been extreme trauma, as in some cases of rape. For evidence of consensual intercourse, the human body doesn’t work that way; it’s like testing a rubber band to see if it’s ever been used.

What tests do quite well, however, is demean those suspected of homosexuality. Suspects generally must strip naked, either bend over or put their legs up in stirrups, and be forcibly penetrated by a doctor’s finger or probe. Allegedly, this enables doctors to determine the shape of the anus, and thus whether the suspect has engaged in anal intercourse. But in reality, said Ghoshal, “Anal examinations prove nothing, and they accomplish nothing, other than humiliating and demeaning people who are considered moral ‘outcasts.’”

Indeed, it’s no coincidence that the United Nations has said that forced anal examinations “amount to torture.” It is less a medical procedure than a rape, and brings to mind the notorious forced sodomization of Abner Louima by New York police officers in 1997. Like the horrifying rape of women in wartime, the rape of men in prison or military contexts is about violence, subjugation, and dominance—not sex or medicine.

It also brings to mind the 1952 U.S. Supreme Court case of Rochin v. California, in which the Court famously stated that forcing a suspect to vomit up drugs was unconstitutional because its brutality “shocks the conscience.”

In the current case, brought by Kenya’s nonprofit National Gay & Lesbian Human Rights Commission, two men allege that in February 2015, doctors at a Mombasa hospital subjected them to forced anal examinations, as well as HIV and blood tests. Such exams violate the Convention against Torture, the International Covenant on Civil and Political Rights, and the African Convention on Human and Peoples’ Rights—all of which Kenya has ratified.

Kenya’s constitution explicitly states that treaties or conventions ratified by the country become part of the country’s laws. The lawsuit also alleges violations of the Kenyan constitution itself, which includes rights to equality, human dignity, privacy, and “the highest attainable standard of health.” Thus, the forced exams violate both international law incorporated into Kenyan law, and the text of the Kenyan constitution.

Today’s ruling was inconclusive, but bodes well for the petitioners. Surprisingly, lawyers for the government said they needed more time to prepare their case. The judge gave them a tight deadline: seven days. This, Ghoshal told The Daily Beast, suggests that the judge thinks that the government either doesn’t have a good case, or doesn’t have a good excuse for being late. “The hearing at the Mombasa High Court today sets Kenya on the path toward eliminating forced anal testing,” she said, describing it as “an astonishingly antiquated and abusive practice.”

Since 2010, Human Right Watch has documented the use of forced anal examinations in Cameroon, Egypt, Kenya, Lebanon, Tunisia, Turkmenistan, Uganda, and Zambia. Since then, Lebanon’s physicians association and justice minister have called for an end to the practice, though HRW says it still sometimes takes place.

Of course, these eight countries are only where the practice has been documented; given its power to humiliate those suspected of being sexual or gender deviants, it is probably far more widespread than has been reported.

And given the violence that suspected gay men face around the world—often extrajudicial in nature, but sanctioned by governments from Russia to Malaysia to the Caribbean—the most distinctive element of forced anal exams is not their intrusiveness, but their appearance under official color of law. At least in cases like this one, there is someone to sue, and laws to sue them under. Most LGBTQ victims have even less recourse.

Of course, the whole pretext for the practice is the criminalization of homosexuality itself. In Kenya, activists are working to overturn the ban, often by engaging religious leaders as well as political ones. The Daily Beast’s Quorum: Global LGBT Voices project profiled one such activist last year. Until legalization takes place, however, the risk of state violence such as forced anal exams remains.

According to Ghoshal, Kenyan constitutional rulings can take anywhere from one month to several months, just as in the United States. We won’t know until then whether Kenya will bring the world one step closer to abolishing an antiquated pseudo-medical practice for good. But thanks to two brave petitioners and a group of dedicated activist lawyers, there’s a good chance that it will.