When I first arrived in Cairo at 23, in 2003, I didn’t know what it was like to live under an authoritarian regime that took a hard-line approach to censorship. Having grown up in the U.K., I took press freedom for granted.

That started to change when I found a job at a local English-language news magazine called the Cairo Times. The magazine was owned by an Egyptian human rights activist, and, because it was published in a language a minority of Egyptians could read, it had a little more latitude than Arabic-language publications to report on issues that strayed close to the red lines laid down by the regime.

But, like all print publications in Egypt, the Cairo Times practiced a degree of self-censorship, because to not do so was to court disaster. It was against the law to criticize Hosni Mubarak or a member of his family. It was against the law to publish anything that might damage “national unity,” “public order,” or “public values.” Andto make sure foreign journalists were also caught in the net—it was against the law to “damage Egypt’s reputation abroad.”

I liked working at the magazine. My colleagues were an oddball mixture of Western and Egyptian reporters, most of them in their 20s. The office was in a dusty, high-ceilinged room that had once been part of a gracious townhouse in an old colonial—now crumbling—area of central Cairo. But every morning as we arrived at the office we’d pass two stocky men sitting in a car outside, smoking or eating shawarma sandwiches. They always looked bored. These were the representatives of the Amn El Dawla, part of the two-million-person state security force that propped up the Egyptian regime.

The apparatus of censorship had been gradually refined since the nationalist coup of 1952 that brought the first of Egypt’s modern military governments to power. The red lines were not only political but religious and “moral,” creating scapegoats of unpopular minorities such as Shia Muslims, gay people, liberal activists, and atheists. Not even the country’s most famous writers could escape. In 1959, Nobel Prize–winning author Naguib Mahfouz’s allegorical novel Children of Our Alley was banned for offending Islamic sensibilities.

In the early 2000s, young people trying to evade the censorship imposed on the largely state-owned press were finding an outlet online, thanks, ironically, to a pro-Internet policy driven by the president’s son Gamal Mubarak. Bloggers were at the heart of antiregime activism, but once the government caught on to their activities, several were arrested and jailed. During the 18 days of protest against Hosni Mubarak in early 2011, the regime went as far as to block Internet access completely in an attempt to silence its opponents.

After the 2011 uprising, when I was living in Cairo and researching my book Generation Revolution, I had to register with the ministry of information as a foreign journalist. Following the military coup of July 2013 that brought the then-general Abdel-Fattah el-Sisi to power, the regime attempted to establish an even more extreme monopoly on “facts.”

The government’s focus shifted from post hoc censorship to preventing reporters and writers from working in the first place. Public paranoia reached such a level that journalists attempting to report in public could face a beating by a mob of so-called honorable citizens, arrest, or worse. The state had cultivated this paranoia itself, screening advertisements depicting shifty pale-skinned figures eavesdropping on Egyptians in streetside cafés.

Journalists who questioned the government’s narrative or exposed its grotesque series of human rights abuses—including the details of the Rabaa massacre of 2013, when security forces killed 1,000 protesters (and three journalists) in the street—faced arbitrary arrest and detention. Some detainees, such as the Al Jazeera three, arrested at a luxury Cairo hotel in 2013, became international causes célèbres. The names of many more are little known outside Egypt.

Egypt is now among the top three jailers of journalists in the world. It is a dire example of the disaster that can result when a government seeks to destroy the independence of the press.

Rachel Aspden is a London-based journalist who has reported from Egypt, Pakistan, and Yemen. She is the author of Generation Revolution: On the Front Line Between Tradition and Change in the Middle East (Other Press, Feb.).