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
| Region | Countries that criminalise (maximum penalty) |
|---|---|
| East Africa | Burundi (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 Africa | Eswatini (imprisonment, men only), Malawi (14 years), Zambia (life), Zimbabwe (1 year, men only) |
| Central Africa | Cameroon (5 years), Chad (2 years) |
| West Africa | Burkina 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 Africa | Algeria (3 years), Egypt (3 years, men only), Libya (5 years), Morocco (3 years), Tunisia (3 years) |
| Indian Ocean | Comoros (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 criminalised same-sex relations in a new penal code published in December 2024. The Human Dignity Trust gives the maximum sentence as seven years.
- Burkina Faso followed on 1 September 2025, when 71 unelected members of its transitional parliament voted for two to five years in prison.
- Niger brought in a new penal code in February 2026 with five to ten years for same-sex acts, and ten to 20 years for organising same-sex marriages or forming or funding LGBTQ+ groups. In July, local media reported up to 40 arrests.
- Senegal doubled its maximum sentence to ten years in March 2026, and added three to seven years for “advocacy”. The vote was 135 to none, with three abstentions.
- Ghana’s parliament passed the Human Sexual Rights and Family Values Bill in May 2026. It would criminalise identifying as LGBTQ+ and supporting LGBTQ+ people. In October, the Speaker said Parliament would consider it again because of mistakes in last-minute amendments, before it goes to the President. There are lessons for Ghana in what followed Uganda’s law.
- Kenya already punishes sex between men with up to 14 years. A Family Protection Bill, first proposed in 2023, would go much further. In January 2025 its sponsor, the MP Peter Kaluma, pressed for it to move forward, but it has not become law.
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.