"The people ousted the regime," rang out chants from crowds of hundreds of thousands massed in Cairo's central Tahrir, or Liberation, Square and outside Mubarak's main palace several miles away in a northern district of the capital.
The crowds in Cairo, the Mediterranean city of Alexandria and other cities around the country erupted into a pandemonium of cheers and waving flags. They danced, hugged and raised their hands in prayer after Vice President Omar Suleiman made the announcement on national TV just after nightfall. Some fell to kiss the ground, and others chanted, "Goodbye, goodbye" and "put your heads up high, you're Egyptian."
"Finally we are free," said Safwan Abou Stat, a 60-year-old protester. "From now on anyone who is going to rule will know that these people are great."
The success of the biggest popular uprising ever seen in the Arab world had stunning implications for the region, the United States and the West, and Israel.
Mubarak was the symbol of the implicit decades-old deal the United States made in the Middle East: Support for autocratic leaders in return for their guarantee of stability, a bulwark against Islamic militants and peace - or at least an effort at peace - with Israel.
The United States at times seemed overwhelmed throughout the 18 days of upheaval, fumbling to juggle its advocacy of democracy and the right to protest, its loyalty to longtime ally Mubarak and its fears Muslim fundamentalists could gain a foothold. Those issues will only grow in significance as Egypt takes the next steps towards what the protest movement hopes will be a true democracy - in which the Muslim Brotherhood will likely to be a significant political player.
Neighboring Israel watched with the crisis with unease, worried that their 1979 peace treaty could be in danger. It quickly demanded on Friday that post-Mubarak Egypt continue to adhere to it. Any break seems unlikely in the near term: The military leadership supports the treaty. While anti-Israeli feeling is strong among Egyptians and future ties may be strained, few call for outright abrogating a treaty that has kept peace after three wars in the past half-century.
From the oil-rich Gulf states in the east to Morocco in the west, regimes both pro- and anti-U.S. could not help but worry they could see a similar upheaval. Several of the region's authoritarian rulers have made pre-emptive gestures of democratic reform to avert their own protest movements.
The lesson many took: If it could happen in only three weeks in Egypt, where Mubarak's lock on power had appeared unshakable, it could happen anywhere. Only a month earlier, Tunisia's president was forced to step down in the face of protests.
Perhaps more surprising was the genesis of the force that overthrew Mubarak. The protests were started by a small core of secular, liberal youth activists organizing on the Internet who only a few months earlier struggled to gather more than 100 demonstrators at a time. But their work through Facebook and other social network sites over the past few years built a greater awareness and bitterness among Egyptians over issues like police abuse and corruption.
When the called the first major protest, on Jan. 25, they tapped into a public inspired by Tunisia's revolt and thousands turned out, beyond even the organizers' expectations. From there, protests swelled, drawing hundreds of thousands. The Muslim Brotherhood - Egypt's powerful Islamic fundamentalist movement - joined in. But far from U.S. fears the Brotherhood could co-opt the protests, the movement often seemed to co-opt the Brotherhood, forcing it to set aside its hard-line ideology at least for now to adhere to democratic demands.
Mubarak, a former air force commander came to power after the 1981 assassination of his predecessor Anwar Sadat by Islamic radicals. Throughout his rule, he showed a near obsession with stability, using rigged elections and a hated police force accused of widespread torture to ensure his control.
He resisted calls for reform even as public bitterness grew over corruption, deteriorating infrastructure and rampant poverty in a country where 40 percent live below or near the poverty line.
Up to the last hours, Mubarak sought to cling to power, handing some of his authorities to Suleiman while keeping his title.
But an explosion of protests Friday rejecting the move appeared to have pushed the military into forcing him out completely. Hundreds of thousands marched throughout the day in cities across the country as soldiers stood by, besieging his palaces in Cairo and Alexandria and the state TV building. A governor of a southern province was forced to flee to safety in the face of protests there.
Mubarak himself flew to his isolated palace in the Red Sea resort of Sharm el-Sheikh, 250 miles from the turmoil in Cairo.
His fall came 32 years to the day after the collapse of the shah's government in Iran.
Vice President Suleiman - who appears to have lost his post as well in the military takeover - appeared grim as he delivered the short announcement.
"In these grave circumstances that the country is passing through, President Hosni Mubarak has decided to leave his position as president of the republic," he said. "He has mandated the Armed Forces Supreme Council to run the state. God is our protector and succor."
Nobel Peace laureate Mohammed ElBaradei, whose young supporters were among the organizers of the protest movement, told The Associated Press, "This is the greatest day of my life."
"The country has been liberated after decades of repression," he said adding that he expects a "beautiful" transition of power.
The question now turned to what happens next after effectively a military coup, albeit one prompted by overwhelming popular pressure. Protesters on Friday had overtly pleaded for the army to oust Mubarak. The country is now ruled by the Armed Forces Supreme Council, the military's top body consisting of its highest ranking generals and headed by Defense Minister Field Marshal Hussein Tantawi.
After Mubarak's resignation, a military spokesman appeared on state TV and promised the army would not act as a substitute for a government based on the "legitimacy of the people."
He said the military was preparing the next steps needed "to acheive the ambitions of our great nation" and would announce them soon. He praised Mubarak for his contributions ot the country, then expressed the military's condolences for protesters killed in the unrest, standing at attention to give a salute.
Earlier in the day, the council vowed to guide the country to greater democracy. It said was committed "to shepherding the legitimate demands of the people and endeavoring to their implementation within a defined timetable until a peaceful transition to a democratic society aspired to by the people."
Abdel-Rahman Samir, one of the protest organizers, said the movement would now open negotiations with the military over democratic reforms but vowed protests would continue to ensure change is carried out.
"We still don't have any guarantees yet - if we end the whole situation now the it's like we haven't done anything," he said. "So we need to keep sitting in Tahrir until we get all our demands."
But, he added, "I feel fantastic. .... I feel like we have worked so hard, we planted a seed for a year and a half and now we are now finally sowing the fruits."
Sally Toma, another of the organizers, said she did not expect the military would try to clear the square. "We still have to sit and talk. We have to hear the army first," she said.
For the moment, concerns over the next step were overwhelmed by the wave of joy and disbelief.
Outside the Oruba presidential palace in northern Cairo, where tens of thousands had marched during the day, one man sprawled on the grass, saying he couldn't believe it. Protesters began to form a march toward Tahrir in a sea of Egyptian flags.
Thousands from across the capital of 18 million streamed into Tahrir, where protesters hugged, kissed and wept. Whole families took pictures of each other posing with Egyptian flags with their mobile phones as bridges over the Nile jammed with throngs more flowing into the square.
Abdul-Rahman Ayyash, an online activist born eight years after Mubarak came to office, said he would be celebrating all night, then remain in the square to ensure the military "won't steal the revolution."
"I'm 21 years old," he said. "This is the first time in my life I feel free."
AP correspondents Hadeel al-Shalchi, Sarah El Deeb, Hamza Hendawi, Lee Keath, Marjorie Olster and Maggie Hyde contributed to this report.