When John Mathenge finished primary school in the early 1990s, he dreamed of becoming a lawyer. But his dreams were shattered when life showed him what being gay in Kenya meant.

His sexual orientation was seen as sinful from childhood. Mathenge's father refused to pay his secondary school fees, and he found himself homeless and unable to get even menial jobs, pushing him into sex work.

Mathenge, 37, said he had been forced to move house numerous times after landlords discovered he was gay. He regularly puts up with physical and verbal abuse.

"I have been evicted from seven houses. I have now moved quite far from where there are people who know me. I have to drive for three hours to work just because of my sexuality," Mathenge told the Thomson Reuters Foundation.

"We need to change this environment so I can live anywhere I want, as long as I pay rent."

Mathenge is one of thousands of lesbian, gay, bisexual and transgender (LGBT) Kenyans anxiously awaiting a verdict in a landmark case seeking to decriminalise gay sex, which is punishable by 14 years in jail in the conservative nation.

Homosexuality is taboo across Africa and the persecution of gay people is rife. Sexual minorities are routinely abused, assaulted by mobs, raped by police or vigilantes, or enslaved by criminals, campaigners say.

The National Gay and Lesbian Human Rights Commission (NGLHRC) is one of the groups that petitioned the court to repeal sections of a colonial era Penal Code, which it says violate constitutional rights to equality, dignity and privacy.

LGBT campaigners, Christian and Muslim groups and the office of the attorney general testified at the three-day High Court hearing. The court said on Thursday that it would on April 26 announce the date that it will deliver its ruling.

The government said that decriminalisation of gay sex would lead to the legalisation of same-sex marriage, which is not allowed anywhere on the continent apart from South Africa.

"There is a legitimate expectation some of those unions might end up in marriage," said Jennifer Gitiri, a lawyer with the attorney general's office.

"In the event that would happen, it would be a violation of the constitution," she told the court.

NGLHRC director Eric Gitari said the law was used daily to discriminate against LGBT people - from getting a job or a promotion, to renting housing or accessing health and education.

"If the law is repealed, people will be able to fight from a point of legal confidence," he said.

Same-sex acts are illegal in 32 of 54 African countries, and can lead to imprisonment or even the death penalty, according to the International Lesbian, Gay, Bisexual, Trans and Intersex Association.

There are no accurate figures on the size of Kenya's LGBT community, rights groups said, because many people are afraid to disclose their orientation for fear of being targeted.

Kenya prosecuted 595 people under the Penal Code between 2010 and early 2014, the government reported.

"This law places so much power in the hands of the police and prosecutor," said Gitari, whose organisation provides legal support to people facing prosecution.

"If the law is repealed, all the criminal cases against people will collapse or will be void."

Despite vehement opposition from powerful bodies, Mathenge remained hopeful.

"Even if the courts rule against our favour, we will still continue to fight," he said. "Maybe this case will be an eye-opener and people will realise that there are gay men in Kenya."

Thomson Reuters Foundation