BEIRUT/LOS ANGELES - Before Omar leaves home in the morning, he carefully uninstalls the apps on his phone one by one - no WhatsApp, no Facebook, no Grindr.
"The paranoia is constant," said the 19-year-old gay Egyptian man, who asked the Thomson Reuters Foundation not to identify his home town or real name for his safety.
If a policeman searched his phone, a single WhatsApp conversation or Facebook selfie could be enough to see Omar prosecuted under laws banning "debauchery" and "prostitution" - regularly used in Egypt to criminalize citizens for being gay.
Wiping his phone clean has become a daily routine.
"It's like brushing my teeth," Omar said.
Around the world, marginalized communities are worried the internet is no longer a safe space for them as surveillance grows and hate speech goes unchecked.
An in-depth study of court files published on Monday found police forces in Tunisia, Egypt, and Lebanon are increasingly relying on digital tools to identify, entrap and prosecute LGBTQ+ people - thus "intensifying anti-queer surveillance".
The study by researcher Afsaneh Rigot, with support from data rights group Article 19 and Harvard Law School, reveals the extent that the safety of LGBQT+ people in the Middle East can be compromised by their digital footprints.
Rigot examined redacted paperwork for 29 cases against LGBTQ+ people in Egypt, Tunisia and Lebanon from 2011 to 2020, including gay men, lesbians, trans women and non-nationals, and interviewed nearly two dozen victims and advocates.
Authorities used the presence of certain apps, pictures deemed "effeminate" and even innocuous conversations to prosecute people under a hybrid of anti-LGBTQ+ and cybercrime laws, according to her 130-page report.
Police in Egypt used sting operations to entrap people via dating apps, while authorities in Tunisia and Lebanon tacked on extra charges after searching detainees' phones, it said.
Tunisia's ministries of justice and interior, Egypt's ministry of interior, and the spokesman for Lebanon's security forces did not respond to requests for comment.
The study said LGBTQ+ people's phones were being treated as a virtual "scene of the crime" - treasure troves to be combed for "evidence".
Official mining of suspects' social media and messaging apps to build a case signals a new and alarming trend, it said.
"Their identity is on trial," said Rigot.
"In order to survive, queer people are being forced to erase and hide key elements of themselves from the internet."
EASIER TO PROSECUTE
In Lebanon, advocates have documented hundreds of cases of LGBTQ+ people charged with Article 534 of the penal code criminalizing "unnatural" sex acts.
In Tunisia, "sodomy" is punishable by up to three years in prison, and police are increasingly categorising digital communications between LGBTQ+ individuals as online "offences", the report noted.
Egyptian authorities were the most aggressive in targeting the gay community, Rigot and other advocates found, with cases often referred to newly-empowered "economic courts" that prosecute the "misuse" of telecommunications.
Egyptian police "target gay hot spots ... just randomly arrest people based on their looks and ... search their phones and if they find anything ... they use it as evidence to build the case further," said one victim interviewed in the report.
"Many countries are now enforcing the cybercrime laws in these cases as opposed to the anti-LGBT laws," said Rasha Younes, who researches LGBTQ+ rights in the region for Human Rights Watch.
These tactics have destroyed the "breathing room" that the online world had given gay people in largely homophobic societies, she said, describing the impact as "absolutely devastating".
Omar in Egypt said he lives a double life. He never discusses being gay on WhatsApp, uses fake names on all dating apps, would never meet an online romantic interest in person and avoids neighborhoods where police may set up checkpoints.
"I have to live like a spy," he said. "Almost nobody knows who I really am."
With Tunisia in political upheaval, Lebanon in financial meltdown and Egypt broadly restricting civic freedoms, advocates in each country said comprehensive legal reform was unlikely.
Instead, LGBTQ+ organizations and lawyers are advising communities to regularly wipe their devices, offering tips on digital security, and winning cases on technicalities.
"I tell my clients, 'leave nothing on your phone - always presume the phone will be confiscated'," said Youmna Makhlouf in Lebanon who has defended LGBTQ+ people in court.
Tunisian lawyer Alaa Khameri said he had won acquittals or delayed sentences against LGBTQ+ people by demonstrating that the phone and laptop searches were carried out without a warrant.
"Lawyers use this lack of permission and authorization as our legal defense," he said.
The report also said there was "corporate complicity in the prosecution of LGBTQ people in Egypt, Lebanon, and Tunisia" - meaning the apps shared some responsibility too.
Every one of Rigot's interviewees mentioned popular messaging platform WhatsApp as possibly exposing them, and the report found that screenshots from it were used to try to prove a person was LGBTQ+ in nearly 30 cases.
"Most of the apps we are using are not designed for queer people in a high-risk environment," said Ramy Raoof, an Egyptian privacy expert. "This forces queer people to become digital security specialists on their own.
Some companies have taken action.
WhatsApp offers disappearing messages and end-to-end encrypted backups for additional security, said its public policy manager Kathryn Harnett.
"When you design with the most at-risk groups in mind, it benefits everyone," she said.
Grindr has rolled out several features, including locked screenshots, routine safety advisories, and a version of the dating app that can be installed discreetly - some tailored for specific high-risk countries.
"We have taken the tack of trying to reduce the amount of evidence available to police to as low as possible," said Grindr's director of equality Jack Harrison.
He said firms need to constantly update tools to protect vulnerable users but not pull out from dangerous places altogether.
"The benefits of providing the space and ability for Queer people to connect far outweigh the risks," he said.
Rigot agreed that LGBTQ+ and mainstream apps are key bridges of connection in what can be hostile and lonely environments.
"It's a vibrant and beautiful community online," she said, but added that platforms could ensure that all users were safe by prioritizing the most vulnerable.
"The technology is not neutral in this context."
(Reporting by Avi Asher-Schapiro in Los Angeles and Maya Gebeily in Beirut, Editing by Lyndsay Griffiths and Katy Migiro. Please credit the Thomson Reuters Foundation, the charitable arm of Thomson Reuters, that covers the lives of people around the world who struggle to live freely or fairly. Visit https://news.trust.org)