Zambia sentenced two men to 15 years in prison last week for having consensual sex in the privacy of their hotel room.

In late November, Ugandan police rounded up 125 people in a gay-friendly bar in the capital, Kampala, dozens of whom now face charges.

In Nigeria last week, 47 men pleaded innocent to charges of public displays of affection with the same-sex. They had been detained during a police raid on a Lagos hotel in 2018.

Such cases are triggering heated debates around gay rights on the African continent where homosexuality has become a decisive issue.

So why is Africa such a difficult place for the LGBTQ+ community?

There are many reasons, but colonial laws, religious morality, and the idea that homosexuality is imported by the West are among the most influential, scholars say.

Colonial-era anti-sodomy laws

Of the 72 countries worldwide that criminalize homosexuality, 32 of them are in Africa, where punishments range from imprisonment to the death penalty in countries such as Mauritania and Sudan.

More than half of these are former British colonies where colonial administrators introduced laws prohibiting "unnatural acts".

Activists celebrate in court in May 2019 after Botswana overturned its British-era law criminalizing same-sex relations

The degree to which the laws are enforced varies greatly. Uganda has seen a flurry of recent anti-gay arrests while The Gambia hasn't prosecuted anyone under its anti-sodomy laws since the change of government in 2017.

Even when not enforced, such laws prolong the stigma attached to homosexuality and provide a "justification" for homophobic behavior, Alan Msosa, a Malawian researcher for the University of Bergen in Norway, told DW.

"They give people the chance to say: 'We don't like [homosexuals] because they are criminals."

Africans among the world's most religious people

Around 93% of sub-Saharan Africans are either Christian (63%) or Muslim (30%), making the continent one of the most religious in the world.

These beliefs influence many facets of people's lives, including their attitudes to LGBTQ+ communities.

"Most religious texts say that homosexuality is problematic," writes Amy Adamczyk, an American sociologist, in an article for The Conversation.

"More religious people are more likely to take these religious precepts seriously. When a large proportion of people are highly dedicated to their religion, everyone within the country tends to develop more conservative views."

Muslim and Christian leaders are often vocally opposed to gay sex, and studies show that African media often quote a religious official when discussing homosexuality — much more so than in countries such as the United States.

In 1910, only 9% of Africans were Christian. Now it's estimated that around 63% are.

Some researchers also believe that American evangelical Christians are playing a significant role in shaping negative attitudes to homosexuality in countries such as Uganda, Zambia and Zimbabwe by deliberately promoting conservative religious agendas.

Homosexuality promoted as 'un-African'

Africa's elites, which include political, religious and community leaders, often claim that homosexual practices are an imported Western evil.

Long-term Zimbabwean leader Robert Mugabe called homosexuality "un-African" and a "white disease".

Ugandan President Yoweri Museveni has said it's a "western import."

In the aftermath of the recent sentencing of the two Zambian gay men (which saw the US Ambassador to Zambia saying he was "horrified" by 15-year jail term ), a Zambian bishop called for fellow citizens to protect their own values and culture from outside influences.

Pre-colonial Africans had gay sex

But homosexuality existed in Africa long before the continent was colonized. Extensive evidence collected by anthropologists and other scholars shows that same-sex practices and diverse sexualities can be found all over the continent and predate colonization.

Ancient San rock paintings near Guruve in Zimbabwe dating back 2,000 years show explicit scenes between copulating males.

Same-sex relationships exist in Uganda now, and were also part of many Ugandan communities before and during colonial times

"It was an open secret" that Mwanga II, the 19th century King of Buganda in what is now Uganda, was gay, writes Ugandan scholar Sylvia Tamale in an article entitled Homosexuality is not un-African.

He wasn't alone. In northern Uganda, effeminate males among the Langi people were treated as women and could marry men during pre-colonial times whereas in Zambia, records show youths and adult men had sexual contact during the circumcision rites of the Ndembu.

It also wasn't just men that were involved in homosexual relationships.

"Women to women marriage in which one woman pays brideprice to acquire a husband's rights to another woman has been documented in more than thirty African populations," finds the seminal book on homosexuality in Africa, Boy-Wives and Female Husbands.

Employing homophobia in the fight for power

By calling on their citizens to guard against westernization and protect their own culture, homophobia has become a rallying cry that serves to mobilize and unite the masses.

"Political and religious leaders have exploited the issue to generate support," Alan Msosa told DW.

It's telling that those politicians who are often most vocal in their anti-gay sentiments, such as in Zambia and Uganda, lead countries where democracy is on the decline.

"The mobilization of latent homophobia is a strategy ... to divert attention when a regime's fate is at stake — in elections, due to public opposition, or internal power struggles," find Norwegian academics Siri Gloppen and Lise Rakner in a paper on backlashes against sexual minorities.

Watch video 02:47 Share Choosing love over hate: What it's like being a lesbian in Kenya Send Facebook google+ Whatsapp Tumblr linkedin stumble Digg reddit Newsvine Permalink https://p.dw.com/p/3RKxJ Choosing love over hate: What it's like being a lesbian in Kenya

With the expansion of LGBTQ+ rights often tied to international development aid, African leaders can also gain points with voters by appearing to defy the West with a strong stance against homosexuality, points out Malawian researcher Msosa.

Attitudes to homosexuality more nuanced than thought

He sees homophobia as "an elite project" that doesn't always reflect the reality of how people are engaging with LGBTQ+ communities on the ground.

In a just-released study on attitudes to homosexuality in Malawi, Msosa found 80% of respondents believed homosexual sex is wrong, but 33% still believe God loves people in same-sex relationships.

The idea of human rights for homosexuals is also sometimes misunderstood as promoting the rights of gay men to have sex with boys which can lead to less support for LGBTQ+ rights.

But "when we unpacked certain words using local languages, such as using 'justice, fairness and inclusion' over 'human rights' we found that [Malawians] were more tolerant in their views," Msosa said.

Imported stigma

Before colonization, traditional African societies didn't seem to stigmatize homosexual practices.

"There are no examples of traditional African belief systems that singled out same-sex relations as sinful or linked them to concepts of disease or mental health — except where Christianity and Islam have been adopted," according to Boy-Wives and Female Husbands.