South Africa lgbtThe European Court of Justice offered hope to many persecuted LGBTQI people in Africa.

In a judgment, the court said gay people should be granted asylum in Europe if they face persecution in their home countries because of their sexual orientation.

South Africa, it’s a continent where presidents have called homosexuality un-African, un-Godly and anti-human, where same-sex relations are widely banned and gay people are routinely beaten, jailed, harassed or killed.

Africa, with its mix of fundamentalist Christians, conservative Muslims, and African traditionalists, is increasingly known as the homophobic continent. One country, Uganda, in recent years, considered a law imposing the death penalty for “aggravated” homosexual offences, although the provision was dropped last year.

The Luxembourg-based court for the 28-nation bloc ruled on an appeal from three gay men from Uganda, Senegal and Sierra Leone who sought asylum between 2009 and 2010 in the Netherlands but were refused.

The court said everyone had a right to a private life without the interference of the state and that this right “shall be secured without discrimination on any ground such as sex, race, colour, language, religion, political or another opinion, national or social origin, association with a national minority, property, birth or another status.”

It ruled a person should be granted asylum “where it is established that on return to his country of origin his homosexuality would expose him to a genuine risk of persecution.” It found that the existence of laws against homosexuality did not constitute persecution, but jail terms for offenders did.

The court overruled the argument of Dutch authorities that the men seeking asylum could “exercise restraint” and hide their sexuality to avoid persecution.

In a separate ruling, the court also ruled that Greece’s ban on same-sex civil unions was wrong.

Last month Gambia‘s president, Yahya Jammeh, used his address at the United Nations General Assembly to lambaste gay people, calling homosexuality “the biggest threat to human existence” and describing homosexuality as anti-Allah and anti-human. In a separate instance this year, he called homosexuality satanic.

With such fiercely anti-homosexual statements from political and religious leaders, the killing of lesbian and gay people is common in many parts of Africa. Amnesty International reported in June that African countries are increasingly criminalizing and penalizing same-sex relations.

“Thirty-eight countries in sub-Saharan Africa have laws criminalizing consensual same-sex sexual conduct. Underpinning these laws are deeply entrenched discriminatory social attitudes,” the report said.

It urged countries in Africa to repeal discriminatory laws and to take steps to protect homosexual people or other sexual minorities.

“High levels of sexual and other violence targeting people because of their sexual orientation and gender identity are endemic in some areas,” the report said.

“These attacks – sometimes deadly – must be stopped. No one should be beaten or killed because of who they are attracted to or intimately involved with. In too many cases these attacks on individuals and groups are being fueled by key politicians and religious leaders who should be using their position to fight discrimination and promote equality,” Widney Brown, Amnesty International’s director of law and policy, said in a statement after the report’s release.

In South Africa, where the constitution provides for equal rights for all and outlaws discrimination, some people still encounter severe violence. South Africa has seen a series of rapes and killings of lesbians in townships, with Amnesty International reporting seven killings between June 2012 and June 2013.