CAIRO — Three young revolutionaries, their friendship formed in a classroom and sealed in the fight for their country's future, sat under the fireworks and marveled.
Hosni Mubarak had been the president of Egypt for longer than any of them had been alive. It was almost impossible to believe that he was gone, and that they had helped drive him away.
"Before," said Mahmoud Hafny, 24, "we never dreamed that Egypt could do a revolution like this."
The story of Egypt's historic uprising has a lot to do with the organizing power of the Internet. It took inspiration from the revolt weeks earlier in nearby Tunisia. And it united a strikingly broad cross-section of Egyptians — students, the working class, conservative Islamists and secular liberals — under the banner of ousting Mubarak and remaking the political order.
Perhaps the movement's greatest force, however, was the strength of a generation of young Egyptians who overcame fear, economic hardship, the memories of countless crushed demonstrations and wave upon wave of state-sanctioned violence to occupy the streets of their capital for 18 consecutive days.
In the end, Hafny said on Friday night, as he basked in the afterglow of Mubarak's resignation alongside thousands in Cairo's Tahrir Square, the recognition that people like him weren't going home is what forced the 82-year-old dictator to step aside.
Hafny and his two friends, 24-year-old Islam Mohamed and 27-year-old Islam Gamal, met as engineering students at Cairo University. It was there that they attended their first protests, joining dozens of classmates in supporting and free elections and anti-corruption campaigns in a country where Mubarak's ruling party had effectively banned all formal opposition.
Those demonstrations always seemed to feature more police officers than protesters, and gradually the three of them lost their activist spirit.
They focused on school and went on to stable jobs, putting them in a better position than millions of Egyptians of their generation. Mohamed joined a landscape architecture firm as a consultant, but his monthly salary amounts to less than $400.
He could afford a shared apartment in a decent neighborhood and a few nights out every month. Beyond that, he couldn't see a future.
"I'm eating, but my pockets are empty," said the bookish, light-haired Mohamed. "And I'm thinking, Mubarak and his people are getting rich from tourism, oil, agriculture. My president is stealing from me and I can't open my mouth."
Hafny, who comes from a family of modest means in the southern city of Luxor, joined the Egyptian army's officer corps, where he earns an even smaller salary. He started playing out his prospects in his head and became depressed.
"In Islam, you know, sex outside of marriage is forbidden," said the tall, self-possessed Hafny. "How am I supposed to get married if I can't afford a flat or money for a wedding? Am I supposed to get married at 40?"
On Jan. 28, the three of them joined the biggest crowds they'd ever seen marching across the Nile toward Tahrir Square. A large police contingent was waiting, and in the clashes that erupted that night, Hafny and Gamal recalled standing at the edge of a bridge and watching a police vehicle run over four civilians — a woman and three men about their age. The night ended with protesters setting the ruling party headquarters ablaze and some looters entering the famed Egyptian Museum.
"It's not only about you leaving anymore," Hafny said, describing what protesters suddenly felt about Mubarak. "There is blood between me and you now."
That night, Mohamed's cousin lost the use of an eye when a police officer fired a rubber bullet at close range and struck his face. Reports spread that authorities had let thousands of prisoners out of jails and that looting was spreading across Cairo.
"After the 28th we said, 'OK, this town is ours,'" Mohamed said. "He broke people out of jail. I mean, I can't imagine that. How could he do that?"
They continued to come to Tahrir Square every day, going home only after midnight to rest and change clothes before returning the next afternoon. On Feb. 2, Hafny was in his apartment when he heard that pro-Mubarak gangs had invaded the square, some riding horses and camels. He rushed back to a find scene of medieval chaos.
That night, as the rival groups pelted each other with stones and firebombs and corners of the square went up in flames, Hafny stood on the sidelines and cried for the first time that he could remember.
"How could those people do this for that president?" he asked of the pro-Mubarak gangs. "I stood away from the battle. I thought they will finish each other."
Mohamed and Gamal brought him back to Tahrir the following day, and he was buoyed to see that the demonstrators had held their ground, and the Mubarak loyalists had all but disappeared.
"These people have some kind of power," Mohamed said. "You are sitting with another protester and you feel that his way of thinking is the same as mine. Before, we couldn't take the first step, because we were afraid."
In the end, Hafny said, the regime had tried everything it could to stay in power. On Thursday night, they stood in Tahrir Square watching as Mubarak gave his odd, rambling speech in which he seemed to be clinging to power that had already evaporated.
Suddenly, it was Hafny who was feeling confident.
"He was doing his last chance," Hafny said. "I said to these two: 'Don't worry, he will leave tomorrow.'"
He was right. About 24 hours later, the three of them reclined under a plastic sheet in the square, shaking their heads at the idea that someone had sent wild animals through there barely a week earlier.
"Can you imagine?" Hafny said, laughing.
MORE FROM MCCLATCHY
Follow developments in Egypt on McClatchy's Middle East Diary