A Moroccan court has jailed two men after beating up a feminine gender non-confirming person, a human rights group has said.

The verdict was delivered by a court in Fez following a mob assaulted the victim in July.

Mustapha Jebbour, of the Moroccan Association of Human Rights, said the pair were ordered to pay a fine of 500 dirhams ($55, €50).

Moroccan media have referred to the victim as a gay man. But in the video, it appears the victim may be a trans woman based on the way they present themselves. For the purposes of this article, we will use the gender neutral pronoun ‘they’.

In the video released last month, the victim is seen being punched and hit by several unidentified individuals, and when they try to flee, they are hunted down by the crowd.

Forcing them to the ground, the crowd is seen striking them and kicking them in the head. One thug used a motorcycle to attack the victim as they clearly struggled to stay conscious.

Finding the strength to flee once again, the victim then ran towards a market where a police officer protected them from the clutches of their attackers by drawing his pistol and pointing it in the air.

It was reported that several glass bottles were thrown at the police car that took the victim away to safety.

After seeing the video, it caused outrage in Morocco. Some compared it to the ‘barbarity’ of the Islamic State group.

Following the arrest of the two men, according to the AFP, the justice ministry vowed to ‘deal firmly’ against ‘those who stand in for the law’.

Homosexual acts are punishable by up to three years in prison in Morocco and the country’s laws do not recognize the possibility of gender transition so transgender women could potentially be punished under the same law.

Two gay men were jailed for four months as recently as 19 June for kissing in public – deemed an ‘affront to public decency’ and an ‘unnatural act with a person of the same sex.’