The arrest of at least 25 men during a massive police raid on a bath house in Cairo – instigated by a pro-regime TV channel – is the latest and most dramatic development in a crackdown that has been going on for months, even though homosexuality is not actually illegal in Egypt.

It is reminiscent of a similar crackdown by the Mubarak regime around 2001 (documented in a very detailed report by Human Rights Watch), which included the notorious Queen Boat trial.

One difference between 2001 and now is the existence of social media. Whereas the Queen Boat victims had few public defenders in Egypt, there have been Arab and Egyptian voices openly condemning last weekend’s arrests, though they are undoubtedly still a small minority.

Much of the wrath has been directed against TV presenter Mona Iraqi and her sordid efforts to expose a “den of perversion”. After initially boasting about her achievement on Facebook, Iraqi has now backtracked, claiming she was merely trying to promote sexual health in connection with World Aids Day.

Raiding bath houses does not, of course, stop people having sex, and there are more effective ways to reduce the spread of HIV – such as sex education of the sort people usually lack in Egypt – but they don’t necessarily make for sensational TV.

During the Mubarak regime’s 2001 crackdown, HRW gathered information about 179 men whose cases were brought before prosecutors. In all probability that was only a minuscule percentage of the true total. Hundreds of others were harassed, arrested and often tortured, but not charged.

In the absence of a specific law against gay sex, people are usually charged with “debauchery” under an old law originally intended to combat prostitution. A law against “immoral advertising” has also been used to entrap men seeking gay partners on the internet.

The most publicised of the Mubarak-era cases was the show trial of 52 men following a police raid on the Queen Boat, a floating nightclub on the Nile that was popular with gay men. The trial was accompanied by lurid tales in the Egyptian press alleging everything from prostitution to a gay wedding via devil worship.

Egypt’s prosecutor general, Maher Abdel-Wahid, accused the defendants of “exploiting Islam through false interpretation of verses from the Muslim holy book, the Qur–an, in order to propagate extremist ideas”. They were also charged with “performing immoral acts; the use of perverted sexual practices as part of their rituals; contempt and despite of heavenly religions, and fomenting strife”.

To highlight the supposed danger to the nation, the case was sent to the state security court, specially set up under an emergency law established in 1981 to deal with suspected terrorists. A Cairo newspaper reinforced this view with its front page headline: “Perverts declare war on Egypt”.

The exact reasons for the 2001 crackdown are still debated, and probably several factors were involved. Writing about this at the time, Hossam Bahgat saw it as an attempt by the Mubarak regime to undercut Islamist opposition by portraying the state as the guardian of public virtue: “To counter this ascending [Islamist] power, the state resorts to sensational prosecutions, in which the regime steps in to protect Islam from evil apostates. The regime seems to have realised that suppression and persecution of Islamists will not uproot the Islamist threat unless it is combined with actions that bolster the state’s religious legitimacy.”

He also noted the regime’s practice of using sensational trials to divert public attention from the worsening state of the economy and similar issues. The Queen Boat case was one of three big sex stories that helped to squeeze bad news out of the papers around the same time. One involved a businessman said to have married 17 women, and another was the leaking (possibly by state security) of a video that showed a former Coptic priest having sex with women who visited his monastery in search of healing.

It seems very likely that the crackdown under President al-Sisi is occurring for similar reasons: to distract attention from bigger issues, to show that while suppressing the Muslim Brotherhood the regime is still capable of playing the “morality” card, or a combination of both.

• This is an expanded version of a post that originally appeared on al-bab.com