Nairobi, Kenya (CNN) In a blow to the LGBTQI movement in Africa, Kenya's High Court ruled Friday that a colonial-era law banning same-sex relations should remain in place.

Same-sex relations have been banned since the British colonized Kenya in the late 19th century. Kenya's penal code criminalizes "carnal knowledge against the order of nature." Anyone found engaging in same-sex relationships could face up to 14 years in prison.

In declining to decriminalize same-sex relations, the Kenya High Court said there was not enough evidence of discrimination against the LGBTQI community and therefore it upheld the ban.

LGBTQI campaigners in the country have been fighting to have the law struck out but have faced a long wait after several postponements by the courts since the case was first brought in 2016 to repeal sections of the Kenyan penal code

The decision was not unexpected.

Before the ruling, Waruguru Gaitho, a human rights lawyer at the National Gay and Lesbian Human Rights Commission (NGLHRC), had said: "We are prepared for it to be a protracted struggle. We are well aware that the court process is very long and we are well aware that this is a heavily contested issue. Allows multiple appeals. So we will continue to make our case for equality. "

Thirty-eight out of 55 African countries have enacted laws that make it illegal to be gay. In Somalia and South Sudan it is punishable by death. In Nigeria, it carries a 14-year prison term, and 30 years in Tanzania.

Despite this, activists on the continent are recording small wins.

In several African countries, such as Namibia, Botswana, Kenya, Uganda and Cameroon, the courts have ruled positively in favor of LGBTQI people, and more cases are planned or are currently being reviewed.

Angola's parliament adopted a new penal code on January 23 for the first time since it gained independence from Portugal in 1975. That paved the way for lawmakers to remove the provision characterizing same-sex relationships as "vices against nature," according to Human Rights Watch.

"In casting aside this archaic and insidious relic of the colonial past, Angola has eschewed discrimination and embraced equality," the agency said.

Neighboring Mozambique removed anti-gay laws in 2015, while São Tomé and Cape Verde have also abolished laws criminalizing gay relationships.

And in Botswana, for the first time in the country's history, a transgender man was legally recognized as male.

After a lengthy 10-year battle, the High Court demanded the government change the gender on his identity card from female to male.

The court stated that the Botswana's Registrar of National Registration had violated the man's basic human rights. A few months later, another landmark case in Botswana saw the gender of a transgender woman legally recognized.

While Kenya is still largely a deeply conservative and religious society, its courts has shown some independence in recent years regarding LGBTQI matters.

Last year, an appeals court in Mombasa ruled that forced anal exams on people who are suspected of same-sex activity are unconstitutional,

following the arrest and forced anal exams of two men in 2015. The decision reversed a 2016 court ruling.

Later that year, a Kenyan court temporarily lifted a ban on the controversial film "Rafiki," which told the story of a romantic lesbian relationship.

The ban was imposed by the Kenya Film Classification Board, which said the film was "restricted due to its homosexual theme and clear intent to promote lesbianism in Kenya, contrary to the law."

In allowing the film to be screened to willing adults, the judge said that Kenya is not a weak society whose morals would be weakened by watching a gay-themed movie.

But Kenyan society has not been as eager to embrace same-sex relationships.

"Life in Kenya as an LGBTQ person is most often lived in the closet, and when one comes out then the reality is often facing discrimination, violence, marginalization, and sometimes there are even more severe incidents, such as loss of life," Gaitho said.

Phelix Kasanda, or Mama G as he is popularly known, says he lives a life of torment as gay man in Kenya.

Kasanda says he endures harassment from landlords who constantly evict him and faces discrimination at public health care facilities and even physical assaults.

Kasanda says he chooses not to seek help from police, as it could mean arrest, possible prosecution and up to 14 years in prison.

"If government doesn't protect you then everybody will turn against you," Kasanda said. "Because they know that there is nowhere you are going to take them. You can't report them anywhere. I cannot go to a police station to say I am being harassed because of my sexuality."

In an interview with CNN's Christiane Amanpour last year, Kenyan President Uhuru Kenyatta said LGBTQ rights was "of no major importance" to Kenyans.

"It is not human rights issue as you would want to put it, this is an issue of society; our own culture as a people irregardless of which community you come from," he said. "This is not acceptable, this is not agreeable..."

"It is not a question of the government accepting or not accepting," he told Amanpour.

Religion is a driving factor behind the lack of acceptance.

Reverend Tom Otieno of the Lavington United Church is adamant that same-sex relationships will not be accepted in the country.

"We are not about to accept homosexuality and we will not accept it. even if the courts try to tinker with it, we will go back to court," he said.

"This idea, this push is certainly alien to this country. I will not deny that they have convinced certain Kenyans of the persuasion that that is what they want. Those Kenyans are free to feel that way, but they are not at liberty to impose that on us."

The graphic in this story has been updated to correct the legal status of same-sex marriage in Jamaica.