Kenya's high court, in a much-awaited verdict, has refused to scrap laws criminalising homosexuality, fearing this would lead to same-sex marriage which it said was unconstitutional.
"We find the impugned sections (of the penal code) are not unconstitutional. We hereby decline the relief sought and dismiss the consolidated petition," said presiding judge Roselyne Aburili.
In a remark prompting gasps and mutters from the packed courtroom, she said there was "no conclusive scientific proof that LGBTQ people are born that way".
Gay rights organisations asked the court to scrap two sections of the penal code that criminalise homosexuality.
One section states that anyone who has "carnal knowledge... against the order of nature" can be imprisoned for 14 years.
Another provides for a five-year jail term for "indecent practices between males".
Campaigners argued these laws infringed on their privacy and dignity, fomented discrimination against homosexuals or prevented them from gaining access to healthcare.
However the court dismissed all of these arguments, saying the petitioners had failed to provide sufficient evidence.
Ms Aburili said it did not matter that the petitioners were not seeking the right to same-sex marriage, as decriminalisation would lead to "same-sex persons living together as couples."
This would be in "direct conflict" with a section of the constitution on the topic of family, which mentions that marriage is with a person of the opposite sex.
Today's verdict had been awaited by activists across Africa.
They had hoped for a landmark ruling in their favour, boosting change in a continent where most countries have anti-gay laws and homophobia is virulent in many communities.