Every morning at 5:30, an alarm clock awakens Ahmed Maher from his mattress below a stairwell at his neighborhood police station in Cairo. An officer then escorts him to the toilet and signs a notebook that Maher carries, authorizing his release until 6 that evening. Maher walks a mile to his apartment — "It is my only exercise," he said — in the Third Settlement, a grid of dun-colored tenements at the edge of the desert. After breakfast with his wife and two small children, he takes care of chores aimed at rebuilding his life — renewing his driver's license, reactivating his cellphone; he visits friends and family and searches for a job in civil engineering, his occupation before he was clapped into prison. Whatever he does, he must be back at the police station before sundown. "Every second now is important," said Maher, a slight 36-year-old with a full beard, large eyes obscured behind tinted yellow lenses and a gray woolen ski cap that covered his bald pate. "If I want to visit my mother in Maadi, I can spend three hours getting there and back." The clock is ticking. "If I delay for 15 minutes, the police have the right to send me back to prison," he said.

Maher and I were sitting in his small, dark apartment at 3 o'clock on a Sunday afternoon in February, waiting for his children to return from their first day back at school after a two-week vacation. A television played a soccer match in a corner, and a coffee table was strewn with textbooks from Maher's studies at Cairo University, where he is pursuing a second degree, in political science, this one begun behind bars.

It was just six years ago that Maher was celebrated around the world as a symbol of freedom and democracy. In January 2011, as the leader of a social-media-savvy network of young activists called the April 6 Youth Movement, Maher mobilized hundreds of thousands of Egyptians in demonstrations in Cairo's Tahrir Square and across the country that took down President Hosni Mubarak. The movement was considered for a Nobel Peace Prize, and Maher traveled across Europe and the United States talking about the Arab Spring and Egypt's future with the likes of Ban Ki-moon and Lech Walesa. But the hopes that were raised by the revolution dissolved into sectarianism and chaos, and Maher's aspirations were extinguished within two years. Abdel Fattah el-Sisi, the defense minister and commander in chief of the armed forces, seized power in July 2013 and outlawed protests. Five months later, a judge found Maher guilty of illegal demonstration, rioting and "thuggery" and sentenced him to three years in jail. Another judge added six months to Maher's sentence for "verbally assaulting a public officer while on duty" after he demanded that the police remove his handcuffs while in court for a 2014 appeal. Maher spent almost all of that period sealed in a small cell in a solitary-confinement wing at Tora Prison, a notorious complex on the outskirts of Cairo, built during British rule, that houses about 2,500 political prisoners and common criminals. Hidden behind 25-foot-high walls, the vast compound encompasses seven prison blocks, ranging from a minimum-security facility for policemen and judges convicted of taking bribes to the supermax "Scorpion Prison," a labyrinth of cells largely reserved for Islamists and April 6 leaders.

Today Maher is nominally a free man, but the restrictions on his movements are stifling. The regime is deeply concerned that he could revive the social-media network that brought his followers to the streets six years ago. As it was explained to Maher, "tweets can lead to demonstrations, and demonstrations can lead to revolution, and that will bring down the regime and create martyrs," he said. "So if you are tweeting, you are like a terrorist."

Every day for the next three years, Maher must spend 12 of every 24 hours at his local police station, a "surveillance period" intended to ensure that he refrains from anti-regime activity. Under Egyptian law, he told me, low-risk felons "have the right to have their surveillance inside the home with a guard downstairs. But they are using this surveillance as punishment. It is a kind of control to keep me all the time under pressure."

The front door opened, and Maher's wife, Reham, their daughter, Meral, 9, and their son, Nidal, 5, spilled into the room. Nidal raced to the television, switched it from the soccer match to a cartoon and then snuggled up to his father. "I missed these moments," Maher said. During his incarceration, his contact with the children was limited to short visits twice a month. The encounters left his kids perplexed and disturbed. "At first I lied when they would visit me," Maher recalled. "My daughter asked, 'Why you are not in our home?' and I said, 'This is my job.' She said, 'So why are you wearing blue?' " Reham, who met Maher at Cairo University 16 years ago and married him in 2007, told me that after a year they decided to explain the situation to their daughter. "I tried to make her grasp the difference between being detained for political reasons and being a common criminal," Reham said. "I explained what the revolution was and how people protested. And I told her that when the current regime took over, it didn't allow people to express their opinions. Sisi knew what happened to Mubarak, so he didn't want them to speak out again."

In prison, Maher earned a reputation as a defiant figure, repeatedly sending antigovernment criticism and vivid descriptions of his ordeal to the Western and Egyptian news media. "When I heard the president talk about the rule of law and human rights in Egypt, I said, 'What is this bullshit?' " he told me. "That made me want to write about the reality." Denied pens and paper, he scribbled messages on tissues, using pens smuggled into his cell, and managed to smuggle the notes out. After they were published, guards would tear apart his cell, removing bricks from walls to search for hiding places. They confiscated his books, radio and clothes, leaving him with only his thin prison uniform. At one point, they covered the open exercise yard with a tarpaulin, blotting out the sunlight, suspecting that Maher might somehow be smuggling messages through the air. Still he continued devising acts of rebellion. A year into his confinement, Maher grew an extravagant handlebar mustache and a long beard and then braided it. "It bothered them — it seemed like I was making fun," he said. "The prison officials complained to my father. They said, 'Please tell him to shave.' "

After getting out of jail, Maher decided to keep wearing facial hair; it helped disguise his identity. Maher's face is widely recognized in Egypt, and other April 6 Youth Movement leaders have been physically attacked by regime loyalists who blame them for plunging the country into instability and violence. When his wife enrolled their children in private school after Maher was sentenced to prison, she told the administrators that their father was "out of the country on business." The school never connected their father's name to the famous activist, and even now, Maher said, when he picks his children up from their school, the staff has no idea who he is.

Maher had to be careful with what he told me; the regime might send him back to prison if he criticized Sisi too harshly. "Even if it was something minor, they would jail him," Reham said. "It would be a catastrophe for us." Yet Maher's reluctance runs against all his instincts. Since his release, he has sensed a deepening anger toward the regime, and he believes that the political climate may be changing. "People tell me that they can see through the lies," he said, "and that they are supporting us."

Left: Ahmed Maher, the founder of the April 6 Youth Movement. Right: Mamdouh Gamal, a former member of the movement.

Rena Effendi for The New York Times

Sisi's crackdown on the opposition far exceeds the darkest period of repression during the Mubarak era. Human rights groups claim that as many as 60,000 political prisoners now languish in Egypt's jails. (At the end of Mubarak's rule, the figure was between 5,000 and 10,000.) Egypt's prisons are filled to triple their capacity, and the regime has built 16 more prisons to handle the overflow. Once described by Amnesty International as "Generation Protest," the youths who took to the streets in Egypt to bring down a dictator in 2011 have acquired a grim new nickname: "Generation Jail."

Many Egyptians have accepted Sisi's argument that another prolonged round of protests could invite radical Islamists to capitalize on the chaos. "He's positioned himself as the sole leader who makes decisions because he knows what's best for the nation, and he's saving us from the fate of Syria and Libya," Khaled Dawoud, a prominent Egyptian journalist and the leader of a small opposition party, told me. Egyptians are proud that the first Arab leader to whom President Trump spoke after his electoral victory was Sisi, a sharp contrast to Barack Obama, who had suspended military aid to Egypt for two years after the police massacre of 1,000 Muslim Brotherhood supporters in August 2013 at Rabaa, a Cairo encampment. Obama never invited the Egyptian president to the White House. "The thinking is, Egypt is returning to its rightful place as a player," said a veteran political observer in Cairo, who like many officials I spoke to feared retribution for discussing even innocuous-seeming elements of Sisi's policies.

Sisi's crackdown has unfolded amid one of the most expansive overhauls of the legal system in Egyptian history. After declaring a state of emergency and disbanding Parliament in 2013, he issued a series of presidential decrees that granted him unprecedented power to silence his critics. A protest law enacted in November 2013 requires three days' notification before a demonstration can take place and gives the Interior Ministry the right to "cancel, postpone or move" the protest if it determines protesters will "breach … the law." Broad new counterterrorism laws have expanded the definition of terrorism to include civil disobedience; this gives prosecutors latitude to roll over 15-day pretrial detention periods, in many cases without limit. And once a case gets to court, a compliant judiciary, long regarded as hostile to the opposition, has been unforgiving in its sentencing. "This is an extraordinarily conservative institution," one official told me, explaining that judges tend to favor a "maximalist approach" to eliminate threats to the public order and safeguard their own interests. "They are overwhelmingly the children of judges, like gondoliers in Venice. It is a family business." According to the Arabic Network for Human Rights Information, a watchdog group in Cairo, the minister of justice has fired almost half of the 75 judges who called for more democracy in an open letter to Sisi and replaced them with hard-liners. Two hundred others have been sidelined with administrative chores or have left the country.

One of the most notorious magistrates, Mohammed Nagy Shehata, known as the "executioner judge," a holdover from the Mubarak era, has handed out hundreds of lengthy prison terms and death sentences to pro-democracy activists. In early 2016, Shehata sentenced three young members of April 6, who were attending a memorial service for a murdered comrade when they were arrested, to life terms for protesting without a license, possessing fireworks and spreading false information. (The sentences were later reduced to 10 years.) In June 2014, another Cairo judge sentenced 25 peaceful demonstrators, some of them teenagers, to 15 years for violating the protest law, blocking roads and attacking public institutions. "Kids are going to jail for four or five years," Dawoud said, "being portrayed as anarchists and terrorists. No country in the world jails its young people for that long for demonstrating peacefully." During the Mubarak era, he said, "I would take part in demonstrations and spend three days in a police station. We got released because we were students, and they were not going to destroy our future. There is no more of that kind of thinking."

Sameh Samir, a lawyer with the Egyptian Center for Economic and Social Rights, a nongovernmental organization that defends many protesters, told me that his office has been overwhelmed by the caseload. "They are making random arrests, just sweeping people off the streets," he said. The regime has hampered the ability of human rights groups like Samir's to defend protesters, freezing their bank accounts and making it increasingly difficult to accept foreign funds, often a lifeline for such organizations.

Ten and a Half Kilometers Camp, a collection of concrete bungalows surrounded by a fence just off the Cairo-to-Alexandria highway, typifies the prisons of the Sisi era. Built under Mubarak to house violent Islamists, the camp today serves as a pretrial detention facility for Islamists and a handful of secular political prisoners. A founding member of April 6 named Ayman, who did not want his last name mentioned, landed there in December 2015 after participating in an illegal protest. Thrown into a 26-foot-by-13-foot cell with 35 Islamists, he slept amid a crush of other prisoners on a blanket on the concrete floor. They defecated in a hole surrounded by curtains and were never permitted to leave the cell. "You need to take the word 'privacy' out of your dictionary if you are going to survive," he told me.

After two weeks, Ayman was moved into a tiny disciplinary cell with 11 other prisoners to await interrogation. They shared a few thin blankets, drank unpurified water from a rusty pipe and survived on one piece of stale bread and cheese each day. A fluorescent light in the 10-foot ceiling shone day and night. "We learned how to get it unscrewed by standing on each other's shoulders," he said. "We had to use a little acrobatics." Twice during his 26 days in the unit, he was shaken awake in the night, blindfolded, taken to an interrogation room and questioned for hours. "They asked me how the hierarchy of April 6 worked, how do we communicate," he said. "I didn't give them any names." The authorities finally moved him to Al Kanatar Prison, 15 miles from Cairo, where, after 20 days, a judge ordered his release.

Ayman said that many of the prisoners he met were from the Muslim Brotherhood, the Islamist political organization that briefly held power after Mubarak. The group formally renounced violence in the early 1970s, but Ayman watched his cellmates grow hardened in prison. "The torture and unjust imprisonment for long periods without clear charges or trial dates created human bombs," he said. "Each one of them was just waiting to get out. They are so thirsty for revenge." Last April, when he heard that the authorities were again looking for him, Ayman sought refuge in South Africa, where his wife and two young daughters eventually joined him.

Left: Dr. Walid Shawky, a dentist and a member of the April 6 Political Committee. Right: Mohammed Samy, the acting coordinator of the movement.

Rena Effendi for The New York Times

Egypt's slide back into authoritarianism wasn't foreordained. Today the leaders of April 6 admit that they weren't prepared for the challenges that followed their initial success. Many of them were barely out of their teens; Maher, from a politically aware, middle-class family in Cairo, had built the group online, connecting on Facebook and embracing civil-disobedience techniques that he learned while demonstrating for human rights and judicial independence with a small pro-democracy movement. He was beaten and jailed repeatedly. The group took its name from the date of a sit-down strike in Cairo that Maher organized in 2008 in solidarity with textile workers in the Nile Delta. That led to small demonstrations against corruption and police brutality, which were quickly broken up by Mubarak's security forces. Then, on Jan. 25, 2011, a protest march on Egypt's National Police Day exploded into a nationwide movement. Late that morning, Maher watched with amazement as crowds filled Tahrir Square and said: "We made a revolution! We made a revolution!"

Days after the Feb. 11 resignation of Mubarak, one of the world's longest-serving tyrants, the Supreme Council of the Armed Forces, a transitional military body, sent a bus to pick up Maher and three other protest leaders and took them to a villa owned by military-intelligence officials. Sisi, then the intelligence chief, and two other generals greeted them respectfully, Maher recalled. "Sisi said: 'You are heroes. You did miracles. You brought down Mubarak. You did something we failed to do for years. But now we need you to stop demonstrating.' "

Maher and the others rejected Sisi's request. "We said: 'The revolution is not complete. We need to change the cabinet, change the structure of the government.' We kept sending them demands." Over the next six months, Maher met with Sisi three times. "We said the same, and he said the same. 'We need to stop demonstrating; stand together against the enemies.' Sisi always hated the protests."

After Mubarak's downfall, Maher traveled to the United States and captivated students in gatherings at New York University, Harvard, M.I.T. and American University, and met with leaders of the Arab-American community. In Europe, he talked politics and revolution with the first vice president of the European Commission, Catherine Ashton; officials from the United Nations Human Rights Council; and Green Party and Social Democratic representatives to the European Parliament in Brussels. Western diplomats and politicians underestimated the structural weakness of the secular democrats, the grass-roots appeal of the Islamists and the entrenched power of the "deep state" — military intelligence and the state security apparatus.

Back in Egypt, the April 6 leaders searched for a strategy. "We didn't have a vision," admitted Walid Shawky, a dentist and a member of the April 6 Political Committee. "We didn't have an answer for what comes next." Maher struggled to articulate an ideology, vaguely describing the group's leanings as "social democratic, social liberal" — somewhere between unfettered capitalism and Soviet-style communism. There were debates between those who wanted to transform April 6 into a secular political party that would challenge the Muslim Brotherhood and those, like Maher, who believed that such a transformation was too ambitious. The Brotherhood "outnumbered us 10 to one," he told me. "I thought that being a pressure group to write a new Constitution would be a better role for us." April 6 began an awareness campaign throughout the country. "We used to go out with slide projectors in rural areas, teaching people of all the [human rights] violations made by the Supreme Council of the Armed Forces," recalls Mamdouh Gamal, one of tens of thousands of youths who joined the movement in the immediate aftermath of the revolution. He has since left it.

While April 6 members continued their activism, the Islamists cemented their political advantage. The Muslim Brotherhood won parliamentary and presidential elections but enraged much of the population when it tried to draft a Constitution based largely on fundamentalist Islamic principles. By the end of 2012, Egypt was in chaos. "There were street fights, people at one another's throats, a real possibility of civil war," remembered Dawoud, the journalist. April 6 gave its support to Tamarod, a grass-roots movement that gathered hundreds of thousands of signatures favoring early elections that, they believed, would remove the Muslim Brotherhood from power. Maher believed that they had the military's support. Instead, on July 3, 2013, Sisi went on television and announced that he was deposing President Mohammed Morsi and seizing power. He suspended the Constitution, disbanded Parliament, declared a state of emergency, ordered the arrests of Morsi and other Muslim Brotherhood leaders and then in August began the deadly attack on the Brotherhood protest camp at Rabaa. After nearly two years of turmoil, many Egyptians were desperate for stability, and April 6 suddenly found itself lacking any popular support. "At that time, there was not one person in the street who was against Sisi," recalled Amal Sharaf, the April 6 spokeswoman for the foreign media. After the killings, Sharaf said, "we tried to make protests, and we got beaten. People with hammers and knives were chasing us. There was a lot of ugliness."

Days after the coup, the interim president, Adly Mansour, a former Constitutional Court chief justice who was appointed by Sisi as a figurehead civilian leader, summoned Maher to the presidential palace. "He was asked to go on trips to Western countries and say, 'This was not a coup, but something the people had asked for,' " said Ayman, the April 6 founding member. "Maher and the whole leadership of the movement refused to do it. We said, 'This is a military coup — people asked for an early election.' " (Maher won't comment on the incident.) The movement's leaders publicly denounced the Rabaa killings as a "massacre," further antagonizing Sisi and sealing the group's fate. Maher was arrested on Nov. 30 and sent to Tora Prison.

In 2014, as Maher and other April 6 leaders languished in jail, Egypt's Court for Urgent Matters, one of Sisi's favored tools for stifling dissent, banned the group's activities, accusing it of espionage and defaming the state. Last winter, Amr Ali, who succeeded Maher as the April 6 general coordinator, received a three-year sentence for conspiring to overthrow the government and joining an illegal organization, another crippling blow to the movement. "The case against us is not finished," said Mohammed Samy, the acting coordinator of the outlawed movement. "They don't need to capture that many people now, so they put this case in the drawer, and when they want to recapture us, they will open it again."

A portrait of Abdel Fattah el-Sisi (center) in Cairo in 2014, a few months before he became president.

Rena Effendi for The New York Times

The government remains resolute. "April 6 was not at all a peaceful organization," said a top Egyptian official, who was not authorized to speak publicly. "It was an anarchist movement that used violence against the security forces and incited violence. They said, 'We have to topple the government.' " When I pressed him for an example of such violence, he cited, without offering proof, an April 6 member who, during the revolution, "seized a gun from a police officer and threw it in the Nile."

One November afternoon in Cairo, I rode in a taxi along the bank of the Nile, passing the former site of Mubarak's riverside National Democratic Party headquarters, now an empty lot. Set on fire and gutted by mobs of angry protesters in February 2011, the abandoned hulk was finally torn down more than a year ago, ridding the regime of a potent symbol of revolt. "We woke up one morning, and it was gone," my translator told me. We soon found ourselves in Tahrir Square. Though protests still take place there from time to time — high-school students assembled there last June to denounce corruption in Egypt's abysmal education system — the police quickly break them up with tear gas.

While the stability imposed by Sisi has gained him wide support, he has staked his presidency on an economic turnaround that has not materialized. Tourism has collapsed, and the regime spent over $8 billion on a huge expansion of the Suez Canal, a money pit that depleted foreign-currency supplies and set off shortages of sugar, medicine and rice. Sisi alienated poor Egyptians by raising the price of gasoline and instituting a tax to obtain a $12 billion loan from the International Monetary Fund. Two days before my arrival last November, the regime devalued the Egyptian pound by 48 percent to combat a black market that has siphoned almost all hard currency from the legal economy. Many economists applauded the move, but the punitive effects were being felt by everyone from tuk-tuk drivers to an administrator at an international high school in Cairo. The school was suddenly facing a doubling of its expenses, because its expatriate teachers were paid in euros. "We may not last until the end of the year," he told me.

I met the school administrator at an evening soiree, attended mostly by gay Egyptians, including my translator, and hosted by a European diplomat at his elegant apartment in a building a few blocks from the Nile. The atmosphere was festive but rife with anxiety: In a sweeping crackdown, the police have been shutting gay bars and nightclubs, entrapping gay people using online dating sites, even raiding private homes in the name of debauchery and prostitution laws.

The persecution has gone far beyond the Mubarak regime's sporadic attacks on the gay community. Over crème brûlée and Egyptian red wine, I chatted with a towering bearded man who had spent four years as a closeted member of a Salafist sect in Alexandria. "I hated myself, and I thought being a Salafist would cure me of being gay," he told me. He had fallen in love with another fundamentalist, a Syrian who jilted him and joined the refugee flood to Europe. The man had returned to the gay scene in Alexandria and Cairo — but the oppressive atmosphere has made it nearly impossible for him to mix socially with other gay men. "We have never seen anything like this in Egypt," he told me. "People are terrified." (A few days after I left Egypt, my translator would seek, and eventually gain, humanitarian asylum in Germany, claiming that the crackdown on gay Egyptians had endangered him.)

Around midnight, the host cleared furniture from the salon, and the crowd gathered around the perimeter of the room to watch the evening's entertainment. A lithe, bare-chested man danced erotically around another man swathed in a black burqa, prying apart the second man's legs and removing a beach ball, a teddy bear and other objects and tossing them around the salon. The lewdly choreographed show, taking place out of sight of Sisi's ubiquitous security forces, seemed an act of defiance. Yet I was asked repeatedly not to identify the location of the party or anything else that might compromise those in attendance.

The country's security forces have displayed their unbridled power in other startling ways. Last year, Ziad Hassan Qenawy, a 3-year-old from the Cairo exurb of Al Shorouk, was detained at Cairo Airport with his father and hauled into court to face sentencing for six guilty verdicts handed down in absentia, ranging from theft to "resisting the authorities." Each was punishable by a year in prison. The boy's lawyer, Mahmoud Al Shinawy, calls the case a revenge plot against the father, an affluent businessman who had refused to submit to a police shakedown. In the courtroom, Shinawy told me: "I had to lift Ziad up so the judge could see him. When the judge saw me carrying the boy, he asked me, 'Why are you bringing your son to the court?' I said: 'This is not my son. This is the defendant.' " Ziad was given suspended sentences, "but he now has a criminal record," Shinawy said. "It will last for his entire life, and he will lose many rights."

Egypt's byzantine justice system seemed to be assiduous in sweeping up toddlers. Last February, a military court found 3-year-old Ahmed Mansour Qorani Sharara and 115 others guilty of killing three people and damaging private and public property during a pro-Muslim Brotherhood demonstration. Ahmed was sentenced to life in prison, but the verdict was later thrown out of court. The police insist that it was a case of mistaken identity and that the real culprit, a teenager, is still being sought.

An alley in the Cairo cafe district known as el-Borsa. The area was once a night-life hub and popular meeting place for revolutionary youths, but it now lies mostly deserted after Sisi ordered the businesses to shut down.

Rena Effendi for The New York Times

One November evening, I met my translator at El Horreya cafe, an 80-year-old beer hall that served as a refuge for protesters fleeing the crush of humanity and occasional clouds of tear gas in Tahrir Square. Today it is a popular late-night hangout for journalists, leftists and members of Cairo's beleaguered L.G.B.T. community. Together we headed for a meeting with an original member of the April 6 movement who has also been caught up in the purgatory of Sisi's courts and prisons. He had spent five months in jail for organizing the April 2016 protest against Sisi's transfer of two uninhabited islands, Tiran and Sanafir, in the Gulf of Aqaba, to Saudi Arabia, apparently in a quid pro quo for desperately needed hard currency, gas and oil. (Egypt's State Council, in a rare display of independence, later ruled the transfer illegal.) The activist had been given a provisional release weeks earlier and had broken a few appointments with me already, but this evening, he promised to make an appearance.

My translator and I walked through the downtown streets, past stray dogs and cats feasting on piles of garbage in alleys, past derelict century-old buildings that looked dangerously close to collapse. After 15 minutes, we arrived at the Eish and Malh bistro, a high-ceilinged pizza-and-salad joint. The April 6 organizer, a skinny 33-year-old with square wire-rim glasses, a white Tour de France shirt, a thin beard and a mop of curly black hair, was smoking furiously at a round table in the center of the large room. He insisted on being quoted anonymously, only to change his mind, saying, "I don't want anyone who reads this to feel it's a fabrication," before anxiously changing his mind again.

He recounted how plainclothes security men had jumped out of five cars at the April demonstration, punched and pistol-whipped him, then pushed him inside one of the vehicles and blindfolded him on the way to the security headquarters. He spent the next five months in pretrial detention, before a judge ordered his strictly supervised release.

Every Monday, Wednesday and Saturday afternoon, in a ritual that mimics Maher's, he walks or takes a tuk-tuk from his home to the local police station and sits on a bench for two hours, a humiliating routine that "has made it impossible for me to have a normal life," he told me, lighting another cigarette. Around us, young Egyptians smoked, ate pizza and worked on their MacBooks, having settled back into their quotidian lives six years after Egypt's aborted revolution and three years after Sisi's military coup. At the end of five months, the organizer must appear again before a judge — who could renew his probation or send him back to jail. He checked his watch and told me he could talk for only 10 minutes more. He was worried that he would be picked up again if he stayed any longer.

"I know that I am always being observed, and it drives you to an obsession," he said. "I have thought about going abroad, but I need to be more psychologically stable first. I need to have the safe feeling, so that I can organize my life again." (His anxieties about being rearrested proved well founded. In February, the police detained him without explanation for six hours; when he arrived late for that day's scheduled detention, he was sent back to prison for 18 days.) As he stood up to leave the pizza parlor, I asked him if the campaign for democracy had accomplished anything. "I don't believe it was a waste," he told me after a pause. "It created a feeling, a space, even if we don't have that now. Even if the people are afraid again, that experience was so important. In spite of everything, I believe it was worth it."

In February, I returned to Cairo to meet Maher, who was released from prison on Jan. 5. As the April 6 leader prepared to report for his own far stricter surveillance, I asked him whether this routine, a constant reminder of the unyielding power of the state, demoralized him. Maher shrugged. He had recently finished reading Samuel Huntington's 1991 book, "The Third Wave: Democratization in the Late 20th Century," and he believed that history would prove his efforts worthwhile. "Huntington wrote that waves of revolution are greater than waves of counterrevolution," Maher said. "So it's three steps forward, two steps back."

A friend picked up Maher at his home, and I followed them in my car to the station. The sun was sinking low over the desert as I drove down the wide street leading from Maher's home, past shabby apartment blocks with laundry drying on every balcony and stunted palm trees lining the meridian. I parked at the bottom of a hill, across the street from the gated police compound, an Egyptian flag fluttering over the entrance. The wail of a muezzin wafted across the neighborhood; four officers stood inside a corrugated-roof guard post just before the gate. The driver embraced Maher and then motored away. Maher wore his woolen ski cap and carried a black satchel containing a novel and a dinner that Reham had prepared for him. "It's a surprise," he told me, hoisting the bag over his shoulder. "I'll find out what it is when I get inside." Then he crossed the road, walked past the four unsmiling policemen and disappeared into the shadows.

Joshua Hammer is the author of "The Bad-Ass Librarians of Timbuktu." He last wrote for the magazine about a Bucknell professor who became the leader of an Ethiopian rebel army.

Sign up for our newsletter to get the best of The New York Times Magazine delivered to your inbox every week.

A version of this article appears in print on March 19, 2017, on Page MM46 of the Sunday Magazine with the headline: Generation Jail.