RABAT, Morocco — A Moroccan court has convicted two men of homosexuality and public indecency, and sentenced each to four months in prison, in the latest case against gays in this North African nation.

Prosecutors at the Temara court near Rabat, the capital, said at Monday’s trial that the men, aged 28 and 19, were caught having sex in a car and arrested. The men denied the charges.

Moroccan law outlaws homosexuality and gives a penalty of six months to three years in prison and a fine of up to 1,000 dirhams ($115). According to the latest figures available from the Ministry of Justice, in 2011 there were 81 trials involving accusations of homosexuality.

The daily al-Akhbar reported on May 9 that three other Moroccans from the northern town of Souq al-Arbaa recently received three-year sentences for homosexuality.

While harsh penalties exist on the books toward drinking alcohol publicly, selling alcohol to Muslims, sex outside of wedlock and other so-called moral crimes, they are rarely enforced in Morocco and police usually ignore people violating such laws.

However, in the case of homosexuality, it is still taboo in this conservative society, and the lawyers for Monday’s defendants were quick to distance themselves from “this phenomenon.”

“If we thought our clients were homosexuals, we would refuse to defend them,” one of the lawyers said to the judge in court. He refused to identify himself to The Associated Press afterward.

In 2010, openly gay singer Elton John headlined the annual Mawazine summer concert series in Rabat, provoking protests from the Islamist opposition party that later came to power in 2011 elections.

Ibtissame Lachgar of the Alternative Movement for Individual Liberties, one of the few organizations defending homosexuality in Morocco, said little has changed under the Islamist government, and she accused authorities of remaining homophobic.

She also lamented the fact that most human rights groups won’t touch the prosecution of gays or call for the repeal of law making homosexuality illegal.

“We are pretty much alone when it comes to individual liberties, and I find that sad,” she told The Associated Press. Her organization, known by its French acronym MALI, has backed other controversial issues such as legalizing abortion and not following the obligatory daytime fast during the holy month of Ramadan.

“They (other rights groups) put the importance of individual freedoms far behind other rights. You can’t talk about human rights if you don’t talk about individual freedoms,” she added.

Aswat (Voices), an online magazine by young gay Moroccans writing under pseudonyms, contains articles defending the rights of homosexuals in Morocco.

According to one contributor, who goes by the name Marwan Ben Said, having a law on the books explicitly criminalizing his lifestyle subjects him attacks by the state and its citizens.

In 2007, a man was attacked by a crowd and stoned after he was rumored to be in a gay marriage. He was later arrested and imprisoned.

“The hardest thing is that I am obliged to live in hiding and to not display my sexuality openly,” Ben Said told AP.

© 2013, Associated Press, All Rights Reserved.

This material may not be published, broadcast, rewritten, or redistributed.