NAIROBI, Kenya (AP) — Kenya's High Court on Friday upheld sections of the penal code that criminalize same-sex relations, a disappointment for gay rights activists across Africa where dozens of countries have similar laws.

The judges' unanimous ruling in the closely watched case was followed by activists' vows to appeal. Many in Kenya's vibrant gay community had hoped the court would make history by scrapping the British colonial-era laws and inspiring other countries in Africa to do the same.

Activists argue that the laws criminalizing consensual same-sex relations between adults are in breach of the constitution because they deny basic rights. The state should not regulate intimacy between gay couples, they say.

One law punishes "carnal knowledge against the order of nature" and prescribes up to 14 years in prison for people convicted of homosexual acts. Another says "indecent practices between males" can bring up to five years in prison.

The laws create an environment of fear and harassment even if they are not always enforced, activists say. "The issue is violence, discrimination and oppression," one activist, Tirop Salat, said.

The judges, however, said the petitioners had failed to prove how the laws violated their right to health, dignity and privacy and said the laws do not single out gay people. Kenya has no social pressure to legalize homosexuality, they added.

"Acknowledging cohabitation among people of the same sex, where they would ostensibly be able to have same-sex intercourse, would indirectly open the door for (marriage) of people of the same sex," said the judgment read in part by Justice Roselyn Aburili.

Reaction was swift.

"These old colonial laws lead to the LGBT community suffering violence, blackmail, harassment and torture. They devastate people's lives and have no place in a democratic Kenyan society," the Nairobi-based National Gay & Lesbian Human Rights Commission said after the decision was announced.

Lawyer Paul Muite for the commission, the main petitioner in the case, said they would appeal.

At least half of Kenya's LGBT persons in Kenya have suffered physical and verbal assault, the commission says. Most assaults are not reported because people don't have confidence that police will protect them, activists say.

In a separate statement, the organization Stonewall UK called the decision "crushing news" and said some 70 countries around the world still criminalize same-sex relationships.

Thirty-three of those are in Africa, according to Human Rights Watch, which called Friday's ruling "a step backward in the progress Kenya has made toward equality in recent years."

Some in Kenya, however, praised the decision as a strike against what they called "sexual perversion." Gerald Walterfang with the Kenya Christian Professionals Forum said they were delighted with the ruling against a "destructive sexual lifestyle" and called the case "an attempt to sanitize what is illicit."

Kenyan Bishop Alfred Rotich added: "LGBT is an orientation. You cannot legalize something as an orientation. If somebody has an orientation to steal money, we cannot legalize it."

Kenya's courts had recently ruled in favor of LGBT rights.

Last year, an appeals court ruled unlawful the use of forced anal exams to test whether two men had gay sex. In 2015, High Court judges ordered a government agency to register a rights group representing gay people, saying Kenya's constitution recognizes and protects the rights of minorities.

Resistance to gay rights exists at the top of Kenya's politics, however.

Gay rights are "not of any major importance," President Uhuru Kenyatta told CNN in an interview last year . He said the laws criminalizing same-sex relations are supported by "99 percent" of the Kenyan people.

The activist who filed the first petition against the laws in 2016, Eric Gitari, told The Associated Press after Friday's decision that "we are worried that this is going to embolden people who do not like LGBT people in Kenya and give them justification to act arbitrarily in harming people. The apprehension of increased violence is very reasonable. What will happen is that more and more people are going to closet themselves, they are going to live in shame and fear."

___

Follow Africa news at https://twitter.com/AP_Africa

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.