Of Africa’s 54 countries, 33 criminalise same-sex relations, according to the Human Dignity Trust, which tracks these laws worldwide. That is half of the 66 jurisdictions that do so anywhere in the world.

The picture has not stood still. Since late 2024, three Sahel countries under military rule have criminalised same-sex relations, Senegal has doubled its penalties, and Ghana’s parliament has passed a new bill. In 2023 and 2024, courts in Mauritius and Namibia struck their laws down.

This guide uses the Human Dignity Trust’s records as of November 2026. Laws change, so check the latest position before relying on it.

Where the death penalty applies

Four African countries have laws that allow the death penalty for same-sex acts in some circumstances:

  • Mauritania
  • Nigeria, in the northern states that apply Sharia law
  • Somalia
  • Uganda, for so-called “aggravated homosexuality” under the 2023 Act

Where the penalty is life imprisonment

The Gambia, Sierra Leone, Sudan, Tanzania, Uganda and Zambia.

The full list

RegionCountries that criminalise (maximum penalty)
East AfricaBurundi (2 years), Eritrea (3 years), Ethiopia (1 year), Kenya (14 years, men only), Somalia (death), South Sudan (14 years, men only), Sudan (life), Tanzania (life), Uganda (death for “aggravated” cases; life otherwise)
Southern AfricaEswatini (imprisonment, men only), Malawi (14 years), Zambia (life), Zimbabwe (1 year, men only)
Central AfricaCameroon (5 years), Chad (2 years)
West AfricaBurkina Faso (5 years), The Gambia (life), Ghana (3 years, men only), Guinea (3 years), Liberia (1 year), Mali (7 years), Mauritania (death), Niger (10 years; up to 20 for marriages or LGBTQ+ groups), Nigeria (death in some states), Senegal (10 years), Sierra Leone (life, men only), Togo (3 years)
North AfricaAlgeria (3 years), Egypt (3 years, men only), Libya (5 years), Morocco (3 years), Tunisia (3 years)
Indian OceanComoros (5 years)

Where a law says “men only”, sex between women is not specifically criminalised. That does not mean women are safe. They are often targeted in other ways.

The countries that have tightened their laws since 2024

Mali, Burkina Faso and Niger are all governed by military authorities that took power in coups.

The countries that have moved the other way

Not every change has been in the same direction. Same-sex relations are legal in these countries, with the year they were decriminalised where it applies, according to records compiled on Wikipedia:

  • South Africa (1998), the first country in Africa to allow same-sex marriage, in 2006
  • Cape Verde (2004), Lesotho (2012), São Tomé and Príncipe (2012), Mozambique (2015), Seychelles (2016)
  • Botswana (2019), Mauritius (2023) and Namibia (2024), all by court ruling
  • Angola (2021), through a new penal code
  • Gabon, which criminalised in 2019 and reversed the decision in 2020

Several countries, including Rwanda, the Democratic Republic of Congo, Côte d’Ivoire, Madagascar and Benin, never criminalised same-sex relations.

Legal is not the same as safe. Only Botswana, Mauritius and South Africa protect LGBTQ+ people from discrimination in their constitutions.

What the pattern shows

Two things stand out. Most of the countries that have recently decriminalised did so through the courts. Most of the new laws have come from parliaments and military governments, often under the banner of “family values” and sovereignty.

Many of the countries on the list inherited these laws from British colonial rule, as Uganda did. That history is set out in the law Britain left behind.

For LGBTQ+ Ugandans who flee, the map matters. Several of Uganda’s neighbours, including Kenya, Tanzania and South Sudan, also criminalise same-sex relations, and LGBTQ+ refugees in Kenya’s camps reported going hungry and being attacked after aid cuts in 2025. A border crossed is not always safety reached.

If you are in Uganda and need help, contact us privately. For legal help, call HRAPF on +256 414 530683.

More stories Contact us