Ahead of a High Court ruling expected later this week that could pave the way for the decriminalization of same-sex relations in Kenya, a gay pastor who leads a predominantly lesbian, gay, bisexual and transgender congregation in Nairobi is optimistic, an epa-efe photojournalist reported Tuesday.

The Cosmopolitan Affirming Church in the Kenyan capital opened its doors six years ago to provide a safe space for LGBT community members of faith who had been excluded from attending services at other churches, where they could not be open about their sexual orientations nor be themselves.

Pastor David Ochara told epa-efe that members of Kenya's LGBT community have been arrested and kicked out of their homes by their parents "because they came out as gay."

Kenya is traditionally a conservative country, where many people are not tolerant of homosexuals and their lifestyle.

Same-sex relations are illegal in the East African nation and are punishable by jail sentences of up to 14 years.

But a court ruling set to take place on Friday could change that.

Ochara said he was "very optimistic" ahead of the ruling. "We really want the court to repeal section 162 of the penal code," he said, in reference to a law that criminalizes gay sex because it goes "against the order of nature."

While Ochara and his congregation hoped Friday's ruling would go in their favor, he said activists would continue their fight even if the court rules against them.

Same-sex relations are illegal in many other countries on the African continent.

In its latest human rights report on Africa, Amnesty International said LGBT people faced "discrimination, prosecution, harassment and violence," singling out Senegal, Ghana, Malawi and Nigeria as among the worst offenders.

In Tanzania, Kenya's southern neighbor, Paul Makonda, the regional commissioner of the country's largest city, Dar es Salaam, launched a campaign in October last year threatening to "round up all gay men" and subject them to invasive examinations and life-time prison terms, according to Human Rights Watch.

Although the Tanzanian government pledged to protect people of all ethnicities and sexual orientations after the World Bank threatened to withhold a $300 million loan, Makonda's explicit threats, as well as the government's ongoing ban of HIV prevention activities, show that much remains to be done to change the prevailing attitudes towards homosexuality, HRW said.

Most of the laws that discriminate against homosexuals have been in place for decades, since the British colonial era.

In India, the LGBT community celebrated a Supreme Court ruling in Sept. last year that overturned a colonial-era law that had criminalized homosexuality. The law had been upheld five years prior to the 2018 ruling in favor of the LGBT community.

Kenya's anti-LGBT law, like India's, is a hangover from the era of British colonial rule.