Is It Illegal to Be Gay in Morocco? Article 489 and Penalties

Yes, it is illegal to be gay in Morocco in the sense that matters legally: Article 489 of the Moroccan Penal Code criminalizes same-sex sexual activity and punishes it with six months to three years in prison, plus a fine of 200 to 1,000 dirhams.1Immigration and Refugee Board of Canada. Morocco: Situation of Sexual Minorities, Including Treatment by the Authorities and Society The law applies to everyone physically in the country, tourists included, and it is not dormant. Moroccan courts prosecuted 838 people under this provision between 2017 and 2020.

What Article 489 Actually Criminalizes

The statute targets what the code calls “lewd or unnatural acts” between people of the same sex. The phrasing is deliberately open-ended, which gives police and prosecutors wide room to decide what counts.1Immigration and Refugee Board of Canada. Morocco: Situation of Sexual Minorities, Including Treatment by the Authorities and Society No public setting is required. No minor needs to be involved. Consensual activity between adults in a private home is just as prosecutable as anything done in public.

Cases rarely start with police catching anyone in the act. They start with complaints from neighbors or family members, or with digital evidence pulled from phones and dating apps. Moroccan courts have treated text messages, photos, and app profiles as enough to support a conviction, which pushes the risk well beyond physical encounters.

The Penalty, and How It Compares

A conviction under Article 489 carries six months to three years in prison and a fine of 200 to 1,000 dirhams.1Immigration and Refugee Board of Canada. Morocco: Situation of Sexual Minorities, Including Treatment by the Authorities and Society The statute allows harsher penalties from other parts of the code if the facts “constitute a more serious offence.” Judges set the specific sentence based on the evidence.

For context, Article 490 criminalizes sexual relations between unmarried opposite-sex couples and carries one month to one year in prison.2Immigration and Refugee Board of Canada. Responses to Information Requests The ceiling for same-sex relations is three times higher. Either conviction leaves a permanent criminal record that affects employment and civil rights.

Public Decency Charges Can Stack On Top

Article 483 creates a separate offense for acts that offend “public decency,” with penalties of one month to two years in prison and a fine of 200 to 500 dirhams. What qualifies as indecent is largely subjective and often turns on witness testimony or an officer’s judgment. Prosecutors reach for Article 483 when they cannot prove a specific sexual act but can argue that someone’s behavior in a public space violated community standards of modesty.

“Public” is read broadly. Parks, beaches, parked cars, and even balconies visible from the street have been treated as public spaces. A single incident can produce charges under both articles. In a 2014 case from Al-Hoceima, two men were convicted under 489 and 483 together.

How Actively the Law Is Used

Between 2017 and 2020, Moroccan courts prosecuted 838 people under Article 489. Reported sentences have ranged from four months up to the full three-year maximum. In a 2015 Rabat case, two men received four months in prison and a 500-dirham fine. In a 2016 Guelmim case, two men received six months each.

Enforcement is also uneven in ways that make the risk hard to predict. Some regions see more prosecutions than others. Some cases come from targeted police operations, others from a neighbor or former partner reporting someone out of spite. That unpredictability is itself part of the exposure.

Phones and Dating Apps Are a Main Point of Exposure

Morocco’s constitution says private communications are secret and that only the judiciary can authorize access to them, and the Code of Criminal Procedure sets conditions for lawful interception. In practice, those safeguards have significant gaps. Police have accessed suspects’ phones during arrests and used the contents as evidence in morality cases. Dating app profiles, private messages, and photos stored on devices have all been introduced in court. Reports from late 2025 describe police accessing the phones of activists during demonstrations and using what they found to build criminal cases.

The practical takeaway for anyone in Morocco is that anything on your phone can become evidence. Dating apps with location services enabled carry a double risk: they can reveal your identity to other users, and they create a record that police can access. In 2020, during the COVID lockdown, at least 50 to 100 gay men were outed after being identified through location-based apps.

The Blackmail Problem

Criminalization produces a secondary risk that is easy to overlook. Blackmailers know their targets cannot go to the police without exposing themselves to prosecution for the very thing they are being blackmailed over. After the 2020 outings, some of those identified were targeted by blackmailers who threatened to send photos or personal information to family and employers. Most victims had no safe way to seek help, because any interaction with police carried the risk of self-incrimination.

Gender Expression and Transgender Travelers

Morocco does not recognize gender identity changes. There is no legal process for updating gender markers on identity documents, and gender-affirming healthcare is not legally available. Authorities have used the vagueness of Articles 489 and 483 to target people based on gender expression rather than any specific conduct. Transgender women have been arrested based on appearance alone, with the way they dress, walk, or speak treated as evidence of public indecency or an offense against public morals. In some arrests, identity documents are confiscated and the person’s name and photo made public, which can cut off employment and housing.

No Anti-Discrimination Backstop

If you are thinking that general anti-discrimination protections might soften the picture, they do not. Morocco’s constitution prohibits discrimination on several grounds, but sexual orientation and gender identity are not among them. There are no employment protections, no housing protections, and no hate crime provisions covering LGBTQ+ people. Someone fired, denied housing, or attacked because of their sexual orientation has no specific legal recourse.

What This Means for Foreign Visitors

The Penal Code applies to everyone physically present in Morocco, regardless of nationality. There is no tourist exception, no diplomatic carve-out, and no informal policy of looking the other way.1Immigration and Refugee Board of Canada. Morocco: Situation of Sexual Minorities, Including Treatment by the Authorities and Society Foreign nationals face the same statutes as Moroccan citizens.

Enforcement against tourists appears less common than against residents, but the legal exposure is the same. A conviction can mean up to three years in a Moroccan facility, followed by deportation. Your embassy or consulate can check on your welfare and give you a list of local attorneys. It cannot override Moroccan law, intervene in the judicial process, or pay your legal fees.

International resort zones can feel more relaxed, and that is a reflection of local enforcement priorities, not a legal protection. Those priorities can shift without notice. Assuming tourists are left alone is a gamble with a three-year downside if it fails.