CAIRO, Egypt — The party at a villa in a western suburb of Cairo was in full swing when three armored police trucks quietly pulled up to the main gate. More than 300 men and women from the gay community had gathered in Kerdassa on the same day, November 4, that former President Mohamed Morsi of the puritanical Muslim Brotherhood first appeared in court. They wanted to party hard and forget the escalating violence that had left hundreds dead and was ripping the country apart.

Without any warning, dozens of black-clad riot police armed with rifles and metal sticks stormed the garden. Terrified people scattered and tried to hide, remembers Ahmed, a gay Cairene in his twenties who is now a fugitive: “They had so many weapons, they had clearly been some serious preparation. They hit everyone they could.”

Police bundled Ahmed into a truck and took him to a station in the satellite city west of Cairo known as 6 October. Together with nine others he was stripped naked and subjected to humiliating “anal tests,” then put on trial. After just one court session nine of the ten defendants were found guilty of debauchery and sexual deviance and handed between three- and eight-year jail terms. Only one, the female owner of the venue, was acquitted.

Ahmed, released on bail, managed to avoid being in court for the verdict and is now “travelling” constantly to avoid re-arrest. Outcast by his family, fired from his job and on the run, he says his life is in pieces.

Since the military overthrew Morsi last July, rights groups have recorded the worst state crackdown on the LGBT community since the days of Hosni Mubarak. Back in 2001, 52 gay men were arrested on a party boat on the Nile and tried for “public depravity”. Twenty-three were sentenced to hard labour in prison. In 2004, a 17-year-old student was handed a 17-year jail sentence for posting his profile on a gay dating site.

In the last 10 months, dozens have been arrested and at least 18 homosexual and transgender people have been jailed under the country’s draconian legislation criminalizing “sexual deviance,” “debauchery” and “insulting public morals.” The prison sentences have ranged from 3 to 12 years.

“We are not even sure if we have documented all the cases,” said Dalia Abdel-Hamid, from Egyptian Initiative for Personal Rights (EIPR). “We know the actual number is higher.”

Abdel-Hamid thinks it’s part of a PR campaign by new President Abdel-Fattah Sisi’s administration, to prove it is more “Islamic than the Islamists” and to curry favor with the population, that sees homosexuality as a sin. It’s also a handy tactic to distract people during election time.

Ironically, under Morsi, when the world railed against the “Islamization” of Egypt, The Daily Beast reported the start of a fledgling LGBT rights movement, as young gay activists launched online awareness campaigns via Facebook and Twitter.

But with the resurgence of the police state after last July’s military coup, LGBT people have become the focus of persecution that the Interior Ministry takes pride in publicizing. The “moral department” of the police force, tasked with managing public behavior, has put local journalists on speed dial to cover the gay arrests. Reporters film the cops’ dramatic raids. Videos of terrified men and women, handcuffed and heads bowed, are gleefully broadcast by Egyptian news networks along with their names and sometimes their addresses.

The Egyptian pro-regime paper Youm7 forced the homosexual and transgender captives of the latest raid in May to give interviews in the middle of their arrest. The same paper, shortly afterwards, published a long investigation into the gay “problem.”

Immediately after arrest, when they are in the police stations, homosexual men are paraded naked and threatened with rape, says Ahmed, who recalls a doctor, in the presence of the arresting officers “checking” his anus to see if he had had sex with a man. “It was utterly humiliating,” he said.

Treatment in jail is worse—anyone identified as a transgender, a cross-dresser or homosexual is singled out and beaten by fellow inmates.

Behind closed doors there remains a flourishing homosexual community in Egypt. Particular bars and nightclubs are earmarked as gay-friendly despite the crackdown, members told The Daily Beast. But many LGBT people are forced to meet online, and that is where the police are hunting them down.

Mohamed Bakeer, a lawyer monitoring the trials, said the police trawl the Internet looking for Egyptian profiles on international dating websites. They post fake accounts and arrange meetings to set up the arrests and use the contact details to tap mobiles, to wire apartments and to set up sting operations.

TSDating.com, a worldwide transsexual-dating site that is also used for escorts, has come in for special attention, said Bakeer. “It will have at least another three or four arrests by the end of the year, they are going systematically through it.”

This will likely get worse as police bolster their web surveillance capabilities. A request for contract proposals leaked to the local press earlier this month showed that the Interior Ministry is seeking to set up a system to scan social media sites and mobile applications like Facebook, Twitter and What’s App for “destructive ideas”— including immorality and profanity.

Human rights workers fear that the crackdown will drive the community further underground and will hurt prevention, testing and awareness of HIV/AIDS in Egypt. Already there is an HIV epidemic among men who have sex with men and intravenous drug users in Egypt. More than 6 per cent of the community is infected.

“That percentage is on the rise,” says Dr. Amani Massoud, who runs EIPR’s Right to Health Program. “Arrests mean outreach efforts become impossible as people operate underground.”

Two of those arrested May5 are HIV positive, and Massoud fears they will not receive treatment in jail.

Straingely, Cairo’s lucrative “cabaret” clubs where sex workers ply their trade have yet to be touched. But with 12 of the 18 men in jail also believed to be sex workers, the transgender and male prostitutes working these joints fear they will be next.

In dimly lit lavish nightclubs the patrons, mostly men from the Gulf, throw wads of cash at stages where both female and male sex workers dance, while live bands play in the background. On a good night workers on the staff are knee deep in cash, collecting as much as $70,000 in small bills. The owners can grease a lot of palms with revenues like that.

The prostitutes pay around $70 to enter and discretely pick up their clients. One male prostitute claimed he is able to charge as much as $1000 a night. “So far the authorities haven’t given these places a hard time,” he told The Daily Beast, but he seemed resigned to a bleak future. “We don’t have a system to look after ourselves,” he said. “It’s not a beautiful life—what is going to happen will happen.”

Young gay men like Ahmed fear the situation will only get worse since Sisi’s recent election gives him what he’ll call a popular mandate for whatever repressive measures he wants to take against any part of society that doesn’t fit his vision of Egypt. For now, Ahmed is stuck in the country’s terrifying judicial system. The police report against him was fabricated, he says. His retrial has been postponed indefinitely. And so he keeps running.

“My life is ruined,” he said, en route to a new temporary home. ”My work, my friends, my family are gone.”