Moroccan police said Wednesday that two suspects have been arrested after a crowd attacked a presumed homosexual in public because of his appearance.
"Two suspects have been arrested for the time being and the investigation will continue to determine the responsibility of other persons," police said in a statement.
The statement, carried by the national news agency MAP, stressed "the firm determination of the authorities to take action against those who act outside the law".
Websites posted a video of the victim of the assault trying in vain to take shelter in a taxi to escape angry youths in the central city of Fez.
The man is seen in the video collapsing to the ground under an avalanche of blows from an expanding circle of youths.
He finally gets to his feet, clothes torn, and tries of take cover in a shop before a policeman appears and holds up his gun to disperse the crowd.
In a widening debate on social media, Le360 website compared the scene to the "barbarity" of the Islamic State jihadist group which carries out public executions in Syria.
The justice ministry announced an investigation.
After a string of controversies over homosexuality, two men were jailed for four months on June 19 for kissing in public in Rabat.
They were convicted of an "affront to public decency" and an "unnatural act with a person of the same sex".
Homosexual activity is punishable in Morocco by up to three years in jail.
A divisive law -- known as Article 489 -- has been the subject of several protests, including a recent topless demonstration by feminist group Femen in the capital.