Homosexuality in Africa: Laws, Enforcement, and Protections

Homosexuality laws in Africa range from full constitutional protection to the death penalty. More than 30 of the continent’s 54 countries criminalize consensual same-sex conduct between adults, with punishments that run from fines and short prison terms to life imprisonment and execution.1European Parliamentary Research Service. LGBTIQ+ in Africa South Africa recognizes same-sex marriage and bans discrimination based on sexual orientation in its Constitution. Botswana and Mauritius have struck down their colonial-era criminal bans through the courts. Uganda, Nigeria, and a growing number of others have moved in the opposite direction, replacing older statutes with broader, harsher ones. The gap between these two poles is wide, and it is still shifting.

Where Same-Sex Conduct Is a Crime

Most of the criminal statutes across the continent trace back to colonial-era penal codes, particularly British provisions against “carnal knowledge against the order of nature” and French laws targeting similar conduct. Many countries have left those inherited laws intact. Others have written newer, more expansive replacements.

Penalties fall roughly into three tiers.

The death penalty is prescribed in a small number of jurisdictions. Mauritania’s Article 308 prescribes death by stoning for Muslim men convicted of same-sex acts, though the country has observed a moratorium on executions since 1987.2Immigration and Refugee Board of Canada. Mauritania: The Treatment of Sexual Minorities by Society and the Authorities Parts of northern Nigeria that apply Sharia law separately from the federal code also prescribe capital punishment. Uganda’s 2023 Anti-Homosexuality Act imposes the death penalty for what the statute calls “aggravated homosexuality,” a category that includes cases where the accused is HIV-positive, the other person is under 18 or has a disability, the accused holds a position of authority, or the accused is a repeat offender.3Parliament of the Republic of Uganda. The Anti-Homosexuality Act, 2023

Long prison sentences apply in most criminalizing countries. Uganda’s basic conviction carries life imprisonment. Nigeria’s Same-Sex Marriage (Prohibition) Act of 2014 imposes up to fourteen years for entering a same-sex marriage or civil union. Across the rest of the criminalizing nations, prison terms for basic offenses typically run from a few years to over a decade, sometimes with fines or corporal punishment attached.

Newer laws reach past the couple. Nigeria’s 2014 statute criminalizes membership in or support of organizations that advocate for LGBTQ+ rights, with a penalty of up to ten years. Uganda’s law criminalizes “promotion of homosexuality” with up to 20 years in prison, wording broad enough to expose healthcare providers, educators, journalists, and funders. Burkina Faso joined the list of criminalizing countries in September 2025 with a new prohibition carrying prison time and fines.

Not every country in the region has such a law. Benin, Ivory Coast, Cape Verde, Angola, Mozambique, Botswana, Mauritius, and South Africa, among others, do not criminalize consensual same-sex conduct between adults.

How the Laws Are Enforced

The broad wording of most anti-homosexuality statutes gives law enforcement wide discretion. In practice, enforcement often looks less like careful investigation and more like targeted harassment, extortion, or social media surveillance.

Digital Entrapment and Phone Searches

Dating apps and social media are primary tools for police in several countries. Officers create fake profiles on platforms like Grindr, arrange meetings, and arrest people who show up. Once someone is detained, police routinely seize the phone and search it without a warrant. Screenshots of private conversations are presented as evidence, and contacts pulled from the device may become the next targets. The pattern is documented in Egypt and Tunisia and mirrors methods used in sub-Saharan countries with similar laws.

Forced Medical Examinations

At least seven African countries, including Cameroon, Egypt, Kenya, Tanzania, Tunisia, Uganda, and Zambia, have subjected accused individuals to forced anal examinations meant to “prove” same-sex activity. The examinations have no scientific validity, and the World Medical Association has called on doctors worldwide to refuse to perform them, describing them as a form of torture. Prosecutors nonetheless present the results as forensic evidence.

Pretrial Detention and Collateral Loss

Lengthy pretrial detention is common, particularly in countries with overburdened courts. Suspects can wait months for their cases to reach a judge. Property and travel documents are sometimes seized. The arrest alone often destroys a person’s livelihood: employers fire them, landlords evict them, and defense costs price most accused individuals out of meaningful legal representation. For many, arrest is the punishment regardless of what happens at trial.

Where Courts Have Struck Down Criminalization

Where legislatures have refused to act, courts have sometimes stepped in, measuring inherited criminal statutes against the rights guaranteed in their own constitutions.

Botswana’s High Court ruled unanimously in 2019, in Letsweletse Motshidiemang v. Attorney General, that sections of the Penal Code criminalizing same-sex conduct violated the constitutional rights to liberty, privacy, dignity, and freedom from discrimination.4Legal Information Institute. Motshidiemang v. Attorney General Botswana The Court of Appeal upheld the ruling in 2021, finding that “there was no discernible public interest” in keeping the provisions on the books.5Human Dignity Trust. Attorney General of Botswana v. Motshidiemang and Ors. (2021)

Mauritius followed in 2023. The Supreme Court declared Section 250 of the Criminal Code unconstitutional, finding it in breach of Section 16 of the Constitution, which prohibits discrimination based on sex, and directed the legislature to amend the law accordingly.6Human Dignity Trust. Abdool Hakime Abdool Rahman v State of Mauritius

Angola took the legislative route. Its 2019 penal code eliminated a colonial-era provision on “vices against nature” that had been linked to criminalizing homosexual conduct, and added protections against discrimination based on sexual orientation in employment.7Office of the United Nations High Commissioner for Human Rights. Angola: Decriminalising Same-Sex Relations a Welcome Step for Equality Mozambique quietly did the same when it adopted a revised penal code in 2015. Each constitutional challenge must be argued on the specific language of each country’s own constitution, but the reasoning in Botswana and Mauritius gives litigants elsewhere a template to work from.

Where the Law Actively Protects

A handful of countries have gone beyond removing criminal penalties and written affirmative protections into law. South Africa leads this group by a wide margin.

Section 9 of the Constitution of the Republic of South Africa, adopted in 1996, explicitly prohibits unfair discrimination based on sexual orientation. It was the first constitution in the world to include this protection.8Department of Justice and Constitutional Development. Constitution of the Republic of South Africa – Chapter 2 That constitutional foundation led directly to the Civil Union Act of 2006, which legalized same-sex marriage and civil partnerships and granted same-sex couples the same legal rights and obligations as heterosexual couples, including inheritance, adoption, and spousal benefits.9South African Legal Information Institute. Civil Union Act 2006

Other countries have taken narrower steps. Cape Verde includes sexual orientation in its employment anti-discrimination protections, meaning workers cannot legally be fired or denied jobs on that basis. Mozambique’s 2015 decriminalization removed the threat of prison but did not add affirmative protections. The gap between “not criminal” and “actively protected” matters: without anti-discrimination laws, individuals in decriminalized countries remain vulnerable to firing, eviction, and denial of services with no legal recourse.

Consequences That Reach Beyond Prosecution

Criminalization statutes reshape sectors of society their text never mentions.

Healthcare access suffers when seeking medical care can lead to exposure or arrest. HIV prevention and treatment programs are directly undermined because people avoid clinics. Uganda’s 2023 “promotion of homosexuality” clause could theoretically be used against healthcare workers who provide services to LGBTQ+ patients without reporting them, and international health organizations have warned that laws of this kind drive HIV epidemics underground.

Organizations and businesses face real exposure under the newer statutes. Nigeria’s law criminalizes supporting or participating in organizations that advocate for LGBTQ+ rights. Uganda’s promotion clause imposes liability on people or entities that fund activities deemed to encourage homosexuality. International NGOs, foreign companies with diversity policies, and aid organizations operating in these countries all sit within reach of these provisions.

Asylum and displacement are the third consequence. Criminalization pushes many LGBTQ+ Africans to leave home, and those who cross into neighboring countries with similar laws find no safety. Refugee camps in East Africa sit in countries that also criminalize same-sex conduct. Some people reach South Africa, but the asylum system there is severely backlogged and xenophobic violence remains a persistent risk.

The Direction of Change

The legal trajectory on the continent is not moving in one direction. Courts in Botswana and Mauritius decriminalized in 2019 and 2023. Uganda passed its harshest-ever law in 2023, Burkina Faso newly criminalized in 2025, and legislative proposals to tighten existing laws have surfaced in Ghana, Kenya, and elsewhere. The ILGA World database reports that 31 of Africa’s 54 UN-recognized states criminalize consensual same-sex acts between adults, a figure that has inched upward even as a few countries move the other way.1European Parliamentary Research Service. LGBTIQ+ in Africa

What is unusual about the current moment is the intensity on both sides. Judicial decriminalization decisions are more thoroughly reasoned and more constitutionally grounded than earlier efforts, giving them stronger footing against legislative backlash. New criminalization laws are broader than the colonial statutes they replace, reaching past private sexual conduct to target speech, association, funding, and healthcare. The legal question across much of Africa is no longer simply whether same-sex conduct is criminal, but how far the state’s reach extends into the lives of anyone connected to LGBTQ+ communities.