
By HistorianSpeaks
In May 2023, Uganda's president, Yoweri Museveni, signed the Anti-Homosexuality Act, one of the harshest anti-LGBTQ+ laws in the world. It allows the death penalty for "aggravated homosexuality" and up to 20 years in prison for "promoting" homosexuality. Supporters described it as a defense of African culture against Western influence. Six months later, on the other side of the continent, the Supreme Court of Mauritius struck down that country's colonial sodomy law, finding it incompatible with the constitution's protection against discrimination.
These two events capture the central contest in Africa today. This fourth part of the HistorianSpeaks series looks at where Africa's anti-LGBTQ+ laws came from, who is fighting to keep them and who is fighting, often at great risk, to bring them down. It also centers the trans Africans whose existence these laws most directly attempt to erase.
Before the Penal Codes
Claims that same-sex love and gender diversity are foreign to Africa do not hold up against the historical record. Anthropologist Ifi Amadiume documented the institution of "female husbands" among the Igbo of Nnobi, in which women could take wives and hold the social role of husband. Among the Hausa of northern Nigeria and Niger, 'yan daudu have long occupied a recognized gender-crossing role. Portuguese and Dutch sources described Queen Njinga of Ndongo and Matamba in the seventeenth century dressing as a king and keeping male consorts dressed as women. In Buganda, accounts of Kabaka Mwanga II in the 1880s describe relationships with male pages; Christian missionaries' outrage over those relationships fed into the conflict that produced the Uganda Martyrs.
Scholars disagree on how to interpret these practices, and they should not be flattened into modern Western categories. But the broader point, made by historians such as Marc Epprecht, is clear: many African societies made room for sexual and gender diversity, and it was colonial law and missionary theology that recast these traditions as crimes and sins.

The Colonial Inheritance
British administrators exported versions of the Indian Penal Code's Section 377 to Kenya, Uganda, Tanzania, Nigeria and other colonies. French colonies inherited a different system; France had decriminalized sodomy in 1791, so most former French colonies did not inherit sodomy laws. Several, such as Senegal and Cameroon, added them after independence. That difference matters. It shows that the heaviest legal burden in Africa today traces to the British imperial model, not to any single "African" tradition.
The Constitutional Breakthroughs
South Africa led the way. Its 1996 constitution, drafted after apartheid, explicitly banned discrimination on the basis of sexual orientation. Anti-apartheid activist Simon Nkoli, a Black gay man who had been tried for treason alongside other activists in the Delmas Treason Trial, helped make the case that freedom from apartheid had to include gay and lesbian South Africans. In 1998, the Constitutional Court struck down the sodomy law, and in 2006 South Africa became the first African country to legalize same-sex marriage. In 2003 it passed a law allowing people to change the sex listed on their documents.
Botswana followed a different route. The group LEGABIBO (Lesbians, Gays and Bisexuals of Botswana) fought for years to register as an organization, winning at the Court of Appeal in 2016. In June 2019, the High Court ruled in favor of Letsweletse Motshidiemang that the colonial-era sections of the penal code were unconstitutional. The government appealed, and in November 2021 the Court of Appeal unanimously upheld the decision. Trans Botswanans had already won a landmark ruling: in 2017, the High Court ordered the government to recognize the gender identity of a trans man identified as ND, calling the denial a violation of his dignity.
Other countries have also moved. Mozambique adopted a new penal code without the colonial sodomy provision in 2015, Seychelles repealed its law in 2016, Angola's new penal code took effect in 2021 and Namibia's High Court struck down its sodomy law in June 2024 in a case brought by activist Friedel Dausab.
Factbook: Africa's Divided Map
Decriminalized: South Africa (1998), Mozambique (2015), Seychelles (2016), Botswana (2019, upheld 2021), Angola (2021), Mauritius (2023), Namibia (2024), among others.
Recent harsher laws: Nigeria's Same Sex Marriage (Prohibition) Act (2014); Uganda's Anti-Homosexuality Act (2023); new criminal provisions in Mali (2024) and Burkina Faso (2025).
Pending: Ghana's Promotion of Proper Human Sexual Rights and Ghanaian Family Values Bill, passed in 2024, lapsed and was reintroduced in 2025.
Trans recognition: South Africa (2003 law); Botswana (2017 ruling); Kenya (Audrey Mbugua's 2014 name-change victory).



The Backlash and Its Funders
Uganda's 2023 law was not the first attempt. A 2014 version was struck down on a technicality. When the new law passed, the Constitutional Court upheld nearly all of it in April 2024. Human rights groups have since documented evictions, beatings and arrests. In Ghana, parliament passed a sweeping bill in February 2024 that would criminalize even advocacy for LGBTQ+ rights; President Nana Akufo-Addo did not sign it before his term ended, and supporters reintroduced it in 2025.
These campaigns are often presented as homegrown. Yet investigations by openDemocracy and others have documented significant funding and organizing from U.S.-based Christian right organizations, including groups that held a 2009 conference in Kampala shortly before the first Ugandan bill appeared, and the Family Watch International network, which has worked with African lawmakers. In other words, the movement that claims to be resisting foreign values is itself partly imported.
The Organizers Who Stay
Against this pressure, African LGBTQ+ and trans activists keep building. Frank Mugisha, executive director of Sexual Minorities Uganda, continues his work even after his organization was shut down by the government in 2022. The late David Kato, a Ugandan teacher and activist, was murdered in 2011 after a newspaper published his photo under the headline "Hang Them." In Kenya, trans activist Audrey Mbugua won a 2014 court victory forcing the national examinations council to reissue her certificate in her chosen name, and in 2023 Kenya's Supreme Court ruled that the government could not refuse to register the National Gay and Lesbian Human Rights Commission. In South Africa, trans-led groups such as Gender DynamiX, founded in 2005, have pushed for health care and legal recognition across the region.
These activists insist on two things at once: that they are fully African and that the laws punishing them are not. That claim is not a slogan. It is backed by history, by constitutions written after independence and by court rulings from Gaborone to Port Louis.


What the Map Shows
Africa is not a single story of persecution. The continent contains both some of the world's harshest anti-LGBTQ+ laws and some of its strongest constitutional protections. What separates them is less culture than politics: who controls the state, who funds the campaigns and who has the courage to go to court. As Part One of this series argued, the colonial penal code was the foreign import. The fight against it is homegrown.
---
Sources & Verification
Laws, dates and case outcomes were checked against court records, the Human Dignity Trust legal database, Human Rights Watch and reporting from Reuters, the BBC and Al Jazeera.
Why your support matters
Follow the global Black story. One dispatch a week, free.
HistorianSpeaks is independent and reader-supported. No corporate owners, no paywall on the daily history. Every member keeps stories like this one coming.
Free
Newsletter
The weekly dispatch in your inbox.
Founding member
$9.99/month
Price locked for life, founder recognition and full Black Thread magazine access.
Become a founderAsk the Historian
Have a question about this story, or an idea for a future post? Send it here.
