The National Gay and Lesbian Human Rights Commission have won a landmark case that will improve LGBTQ rights in Kenya.

In a rare win for the LGBTQ community, the country’s Court of Appeal ruled that it is illegal to force people to undergo anal examination in order to determine if they are homosexual.

The case was brought forward after two men were subjected to the barbaric practice back in 2015, after being suspected of having gay sex with each other.

Same-sex sexual activity is illegal in Kenya and is punishable by up to 14 years in prison.

As part of the investigation, the two men said they were forced to have an anal examination by security personnel and a public hospital to determine if either of them had engaged in homosexual sexual activity.

They were also forced to take an HIV test.

“The NGLHRC has long argued that the tests are a violation of rights to privacy and dignity and amount to torture,” reads a statement from the charity.

© Quinn Dombrowski via Flickr

“The violating examinations, which include being made to lie with legs up in a humiliating position and having instruments forced into your rectum, are widely accepted to have no medical merit.”

The NGLHRC initially lost the court battle back in 2016 when Mombasa’s High Court ruled the anal examinations as constitutional.

But they then challenged the ruling in the Court of Appeal, which has now ruled in their favour.

“The humiliation and pain caused by these useless anal examinations will follow our clients for the rest of their lives,” said NGLHRC’s head of legal affairs Njeri Gateru.

“However, we are emboldened to see our constitution at work, ensuring that all Kenyans have the right to dignity.”

That being said, forced anal examinations are still legal in many African nations, including Uganda, Egypt, and Zambia.

Next on the agenda for NGLHRC is their challenge against a British colonial-era Penal Code which makes gay sex illegal.

The court is expected to announce their ruling on 26 April, so there are hopes it will go the same way as this case.

Related: Kenya is on the verge of either decriminalising gay sex, or making the current laws worse