When Jennifer Lopez took to the stage in Rabat at the end of May, she was unlikely to have realised she was putting herself at the centre of a fierce and divisive debate about civil rights in Morocco.
Dressed in a revealing one-piece body suit, the American singer was appearing as part of the city's Mawazine festival. But while fans rapturously received her performance, prime minister Abdelilah Benkirane called on the country's broadcasting watchdog to sanction public television channel 2M for showing it.
Lopez’s scanty dress and raunchy dance moves, he claimed, attacked “the decency and religious values of Moroccan society”.
The watchdog eventually rejected the complaint of the prime minister, of the moderate Islamist Justice and Development Party (PJD). But it was only one of several recent incidents which have troubled those who fear for the rights of women – and others – in Morocco.
In mid-June, a mob of men in the town of Inezgane harangued two young women for wearing knee-length skirts. Eventually the police stepped in, stopping the two hairdressers, aged 19 and 23, from being assaulted, but the women spent the night in prison and were subsequently charged with "gross indecency".
A young transvestite had a similar, albeit more violent, experience in Fez at the end of June. Mobile phone footage showed him being pursued by a group of men, before he was beaten to the ground and kicked repeatedly. He eventually escaped to a nearby shopping centre.
The backlash by those who fear for civil liberties in Morocco has been immediate. The international activism platform Avaaz started a campaign of support for the two women in Inezgane, under the slogan: “Wearing a dress is not a crime!” It gained nearly 30,000 signatures before the women were acquitted.
There have also been several demonstrations in favour of women’s rights in Morocco’s main cities, an unusual sight in a country where protests are few and far between. One such gathering in Rabat was notable for the fact that many women who took part were wearing trousers.
Liberal sections of the media backed the demonstrators, with Libération newspaper warning of "the worrying rise of an aggressive, menacing conservatism, which meddles with the intimacy of individuals and their personal choice".
Elsewhere, the campaign against conservatism has been more strident. Shortly after the furore over the Jennifer Lopez concert, two French women from the feminist organisation Femen were deported for sharing a topless kiss next to the Hassan Tower, a religious landmark.
The controversy over gender and sexuality-related issues goes back several months to when the government unveiled a new penal code which included prison sentences of up to three years for homosexuals.
After two men were seen kissing at the Hassan Tower in June – not related to the Femen incident – they were sentenced to four months in jail. In an unprecedented move, the interior ministry leaked the men’s names and photograph, leading to anti-gay demonstrations outsides their families’ homes.
For many Moroccans, the recent episodes are particularly disappointing after the introduction of constitutional reforms in 2011 which helped the country to dampen unrest being fanned by the Arab Spring.
Those reforms transferred some powers from the head of state, King Mohammed VI, to parliament and the government. But, as Haizam Amirah-Fernandez, senior analyst on Arab affairs at the Elcano Royal Institute, says, an insular political elite and a lack of economic development are contributing to social polarisation in Morocco.
“There’s a tension between two different ways of seeing society,” he says. “So some believe that skirts should be banned, while on the other hand there are women who campaign to be able to wear a skirt. But conservatism is a widespread social reality and the influences of a restrictive form of Islam are present and on the rise.”