Countries Where It’s Illegal to Be Gay: Penalties and Enforcement

Roughly 60 countries where it’s illegal to be gay still have laws on the books that criminalize consensual same-sex sexual activity, with penalties running from short prison terms and fines to life imprisonment and, in a handful of jurisdictions, death. The map is uneven. Most of these countries sit in Africa, the Middle East, South and Southeast Asia, the Caribbean, and the Pacific, and the severity of the law often has little to do with how aggressively it is enforced.

Where These Laws Come From

More than half of the countries that still criminalize same-sex conduct inherited their laws from Britain. The Indian Penal Code of 1860 included Section 377, which prohibited “carnal intercourse against the order of nature,” and colonial administrators carried that language from India to Nigeria to the Pacific islands. The near-identical phrasing in penal codes from Kenya to Bangladesh to Papua New Guinea reflects that common template. Countries that have repealed these provisions, including India in 2018, Singapore in 2023, and Barbados in 2022, have often framed repeal as a rejection of colonial interference.

A smaller group of countries, concentrated in the Middle East and parts of Africa and Southeast Asia, apply interpretations of Sharia law instead of or alongside colonial statutes. These regimes tend to be the harshest, and some prescribe death.

Countries That Can Impose the Death Penalty

A small number of countries prescribe capital punishment for same-sex conduct. The distinction between a death sentence on paper and executions actually carried out matters, and both appear below.

  • Iran: The Islamic Penal Code prescribes death for penetrative acts between men (livat), along with flogging for non-penetrative acts (tafkhiz) and sexual acts between women (musaheqeh). Iran actively carries out executions, and the UN has documented cases of individuals convicted on inflated charges as a pretext for targeting their sexual orientation. The UK government’s country assessment confirms that floggings, prison sentences, and death sentences continue.1Office of the United Nations High Commissioner for Human Rights. Iran – UN Experts Demand Stay of Execution for Two Women, Including LGBT Activist2GOV.UK. Iran – Sexual Orientation and Gender Identity and Expression
  • Saudi Arabia: The criminal code is uncodified and rooted in Sharia. Judges apply religious law directly, with death as the maximum penalty. Executions have occurred, though the government does not publish systematic data on the charges underlying individual executions. Anti-cybercrime provisions are also used to prosecute same-sex activity online.
  • Yemen: The Penal Code prescribes death by stoning for married individuals convicted of sodomy. Unmarried individuals face 100 lashes or up to a year in prison. Courts controlled by the Houthi militia have sentenced and executed men on charges related to same-sex conduct in recent years.
  • Mauritania: Article 308 of the Penal Code prescribes death by stoning for Muslim men convicted of same-sex conduct. Mauritania has maintained a moratorium on the death penalty since 1987, and no such execution has been carried out in nearly four decades.
  • Uganda: The Anti-Homosexuality Act of 2023 prescribes the death penalty for “aggravated homosexuality,” which covers serial offenders, HIV-positive defendants, and cases involving minors or persons with disabilities.3Parliament of the Republic of Uganda. The Anti-Homosexuality Act, 2023
  • Northern Nigeria: Twelve northern states apply Sharia law prescribing death by stoning, separate from the federal legal system. Regional courts have handed down death sentences, though documented executions specifically for same-sex conduct are rare.
  • Brunei: The Syariah Penal Code Order of 2013 prescribes death by stoning for penetrative sex between men when proven by confession or four witnesses. After international backlash in 2019, the Sultan announced the country’s longstanding moratorium on the death penalty would cover these provisions.4Attorney General’s Chambers, Brunei Darussalam. Laws of Brunei Chapter 275 – Syariah Penal Code
  • Afghanistan: Under Taliban rule, Sharia law applies with death as the maximum penalty. A Taliban judge stated in 2021 that “for homosexuals, there can only be two punishments: either stoning, or he must stand behind a wall that will fall down on him.” Public floggings have been documented through 2024.

Countries With Long Prison Sentences

In most criminalizing countries, the primary penalty is imprisonment, often alongside fines and, in some jurisdictions, corporal punishment. The sentences vary widely.

Uganda

Beyond the death-penalty provision, Uganda’s Anti-Homosexuality Act of 2023 carries life imprisonment for a conviction of same-sex conduct and up to 14 years for attempted same-sex conduct. Promoting homosexuality is punishable by up to 20 years, and the law creates a duty to report suspected violations. Uganda’s older Penal Code of 1950 already criminalized “carnal knowledge against the order of nature” with a maximum of life imprisonment, so multiple statutes now target the same conduct.3Parliament of the Republic of Uganda. The Anti-Homosexuality Act, 2023

Kenya

Section 162 of Kenya’s Penal Code punishes “carnal knowledge against the order of nature” with up to 14 years’ imprisonment, and Section 165 punishes “gross indecency” between males with up to five years.5National Council for Law Reporting. Kenya Code CAP 63 – Penal Code In 2019, Kenya’s High Court upheld both provisions as constitutional.

Nigeria

Federal law prohibits same-sex marriages and civil unions, bans the registration of LGBTQ organizations, and criminalizes public displays of same-sex affection under the Same-Sex Marriage (Prohibition) Act.6Legal Information Institute. Same Sex Marriage (Prohibition) Act On top of this, 12 northern states enforce Sharia-based codes targeting same-sex intimacy between men and women.

Iraq

Iraq is one of the newest additions. In April 2024, amendments to a 1988 anti-prostitution law introduced prison terms of 10 to 15 years for same-sex relations, a minimum seven-year term for “promoting” same-sex relationships, and penalties targeting gender-affirming surgery and organizations that “promote” homosexuality.

Malaysia and Bangladesh

Malaysia’s Sections 377A and 377B prohibit “carnal intercourse against the order of nature” with a maximum penalty of 20 years’ imprisonment and whipping. Both men and women fall under the provisions.7Equaldex. Homosexual Activity in Malaysia Bangladesh retains its own Section 377, carried directly from the British colonial Penal Code of 1860, with a maximum penalty of life imprisonment.8Laws of Bangladesh. Bangladesh Code 377 – Unnatural Offences Formal prosecutions in Bangladesh are reportedly rare, though the law gives police a pretext for harassment.

Guyana, Jamaica, and the Pacific

Guyana is the only country in South America that still criminalizes same-sex conduct, under its Criminal Law (Offences) Act of 1893, with a maximum penalty of life imprisonment. Only men are targeted. Jamaica’s Offences Against the Person Act of 1864 carries up to 10 years with hard labor for same-sex acts between men. In the Pacific, Papua New Guinea’s Criminal Code of 1974 punishes “sexual penetration against the order of nature” and “gross indecency” with up to 14 years. The Solomon Islands’ 1996 Penal Code carries up to 14 years for “buggery” and up to five years for “gross indecency” between persons of the same sex.9Office of the United Nations High Commissioner for Human Rights. Submission for the UPR Review of the Solomon Islands

The Lower End

Some criminalizing countries impose shorter sentences. Turkmenistan tops out at two years. Kuwait sits in the mid-range along with Kenya and Papua New Guinea at seven to 14 years. Corporal punishment is also a documented penalty in several places. Indonesia’s Aceh province, which enforces local Sharia regulations, has publicly flogged men convicted under these provisions, in one widely reported case with 77 lashes each. Yemen prescribes 100 lashes for unmarried individuals, and Malaysia’s code allows whipping alongside imprisonment.

Countries That Criminalize Indirectly

Not every country that effectively criminalizes LGBTQ people does so through a law that names same-sex conduct. Some of the most effective prosecutorial tools are broad morality statutes.

Egypt is the clearest example. Its code does not explicitly mention same-sex conduct. Prosecutors instead use the Law on the Combating of Prostitution (No. 10 of 1961), which punishes the “habitual practice of debauchery,” a term courts have consistently interpreted to cover consensual same-sex acts. Cybercrime laws are now used alongside it, particularly against people on dating apps. The absence of an explicit statute makes the practice harder to challenge in court.

Russia takes a different route. Its “propaganda” law, originally passed in 2013 to prohibit the promotion of “non-traditional sexual relationships” to minors, was expanded in December 2022 to cover adults. The expanded law bans public expression that “promotes or praises” same-sex relationships across all media. Individuals face fines of up to 400,000 rubles, and organizations up to 5 million rubles. The law does not criminalize identity itself, but it effectively bans public visibility.10GOV.UK. Country Policy and Information Note – Sexual Orientation and Gender Identity and Expression, June 2025

Several North African countries use vagrancy and public indecency statutes to arrest LGBTQ people without any reference to sexual orientation, with enforcement left largely to police discretion.

Laws Targeting Gender Identity and Expression

At least 13 countries maintain laws that specifically criminalize gender non-conforming expression, using “cross-dressing,” “impersonation,” and “disguise” provisions to target transgender people. Countries with explicit provisions include Brunei, Malaysia, Nigeria, Saudi Arabia, Qatar, and the United Arab Emirates, among others. In many additional countries, transgender people are prosecuted under the same broad morality and public order statutes used against gay and bisexual people.

Iraq’s 2024 amendments criminalized gender identity directly: men who “intentionally” act like women face one to three years, and gender-affirming surgery is a crime for both the patient and the surgeon, with up to three years’ imprisonment.

Forced Anal Examinations

Law enforcement in at least eight countries, including Cameroon, Egypt, Kenya, Lebanon, Tunisia, Turkmenistan, Uganda, and Zambia, has subjected men and transgender women arrested on homosexuality-related charges to forced anal examinations, seeking physical “proof” of same-sex conduct. The examinations rest on discredited 19th-century pseudoscience, and medical experts are unanimous that no physical examination can establish whether someone has engaged in same-sex conduct. International human rights bodies classify these forced procedures as cruel, degrading, and inhuman treatment that can rise to the level of torture.

Laws on the Books vs. Laws Actually Enforced

A country-by-country list understates and overstates at the same time. Some governments prosecute aggressively, including Uganda, Iran, and Egypt. Others maintain “sleeping” laws that are rarely used for formal prosecution but still serve other functions: justifying police harassment, blocking access to health services, and providing social cover for discrimination. Bangladesh is a clear example. Section 377 is reportedly rarely prosecuted formally, yet its presence gives police leverage over LGBTQ individuals. A law that is never formally prosecuted can still shape daily life through selective enforcement, extortion, and the chilling effect on medical care and reporting crime.

Countries That Have Recently Decriminalized

The headlines about Uganda in 2023 and Iraq in 2024 run against a longer-term trend. Several countries have decriminalized since 2022:

  • Barbados (2022): The High Court struck down Sections 9 and 12 of the Sexual Offences Act, finding violations of constitutional rights to privacy, liberty, equal protection, and freedom from discrimination.
  • Singapore (2023): Parliament repealed Section 377A, which had criminalized sex between men, effective January 1, 2023. The government simultaneously amended the constitution to shield the legal definition of marriage from court challenges.
  • Cook Islands (2023): The Crimes (Sexual Offences) Amendment Bill, passed in April 2023, removed colonial-era prohibitions on same-sex conduct.11UNAIDS. UNAIDS Welcomes the Decriminalisation of Same-Sex Relations by the Cook Islands
  • Mauritius (2023): The Supreme Court declared Section 250 of the Criminal Code unconstitutional in October 2023, interpreting the constitutional term “sex” to include sexual orientation.
  • Dominica (2024): The High Court struck down Sections 14 and 16 of the Sexual Offences Act on freedom of expression, liberty, and privacy grounds.
  • Namibia (2024): The High Court ruled colonial-era sodomy laws unconstitutional in June 2024. The government filed an appeal to the Supreme Court in July 2024, so the final outcome is unresolved.

Courts have moved faster than legislatures in most of these cases, which means some gains could be reversed by new laws.

Asylum in the United States If You Fear Returning

If you are from a country that criminalizes same-sex conduct and fear returning, U.S. immigration law recognizes persecution based on sexual orientation as a basis for asylum. LGBTQ individuals qualify as a “particular social group” under the Immigration and Nationality Act, a category established by the Board of Immigration Appeals in 1990 and reaffirmed by multiple federal courts since.12U.S. Citizenship and Immigration Services. Nexus – Particular Social Group You do not need to have been prosecuted under a criminal statute. A well-founded fear of persecution is enough, and even perceived sexual orientation can establish the required nexus if the persecutor believes you are LGBTQ regardless of whether you are.

The process typically starts with a credible fear screening, in which an asylum officer evaluates whether there is a “significant possibility” that you can establish persecution or a well-founded fear of persecution based on membership in a particular social group. A positive finding sends your case to an Asylum Merits Interview or to an Immigration Judge.13U.S. Citizenship and Immigration Services. Questions and Answers – Credible Fear Screening These claims are fact-specific, and the evidentiary standards vary across jurisdictions. Working with an immigration attorney experienced in LGBTQ asylum claims will meaningfully improve your chances.