LGBT crime
Homosexuality is considered a crime in Morocco Getty

A Moroccan court jailed three men for homosexuality under a law that has drawn widespread criticism from rights groups.

The men were handed the maximum sentence of three years behind bars each by judges in the north-eastern city of Taourirt, local activists reported.

Hassan Ammari, of the Moroccan Association of Human Rights, told AFP that police caught two of the accused "in the act" as they raided the mechanic's workshop where one of them worked. Authorities reportedly acted on a tip-off from neighbours.

During questioning, the pair said they had met through a mutual friend who was also subsequently held.

The three confessed to engaging in same-sex relations and to the additional charges of prostitution and preventing the course of justice, Le Monde newspaper reported.

Homosexuality is a punishable crime according to article 489 of Morocco's penal code.

Human Rights Watch (HRW) has repeatedly urged the conservative northern African Kingdom to drop the legislation that it says is unconstitutional and in breach of international human rights law.

"Private life is protected under Morocco's 2011 Constitution, and yet the government persists in enforcing the law that criminalises consensual same-sex conduct," Graeme Reid, director of the Lesbian, Gay, Bisexual and Transgender Rights Program at HRW, told IBTimes UK.

"Convictions under this law are unjust. They also damage people's lives because of the social stigma against homosexuality, which the law reinforces. Morocco should immediately stop enforcing the law, pending its repeal."