CAIRO (AP) - Cries of "Egypt is free" rang out and fireworks lit up the sky as hundreds of thousands danced, wept and prayed in joyful pandemonium after 18 days of peaceful pro-democracy protests forced President Hosni Mubarak to surrender power to the military, ending three decades of authoritarian rule.
Ecstatic protesters in Cairo's Tahrir, or Liberation, Square hoisted soldiers onto their shoulders Friday and families posed for pictures in front of tanks in streets flooded with people streaming out to celebrate. Strangers hugged each other, some fell to kiss the ground, and others stood stunned in disbelief.
Chants of "Hold your heads high, you're Egyptian" roared with each burst of fireworks overhead.
"I'm 21 years old and this is the first time in my life I feel free," an ebullient Abdul-Rahman Ayyash, born eight years after Mubarak came to power, said as he hugged fellow protesters in Tahrir Square, where crowds remained all through the night.
An astonishing day in which hundreds of thousands marched on Mubarak's palaces in Cairo and Alexandria and besieged state TV was capped by the military effectively carrying out a coup at the pleas of protesters. After Mubarak's fall, the military, which pledged to shepherd reforms for greater democracy, told the nation it would announce the next steps soon. Those could include the dissolving of parliament and creation of a transitional government.
Mubarak's downfall at the hands of the biggest popular uprising in the modern history of the Arab world had stunning implications for the United States and the West, Israel, and the region, unsettling rulers across the Mideast.
The 82-year-old leader epitomized the complex trade-off the United States was locked into in the Middle East for decades: Support for autocratic leaders in return for stability, a bulwark against Islamic militants, a safeguard of economic interests with the oil-rich Gulf states and peace - or at least an effort at peace - with Israel.
The question for Washington now was whether that same arrangement will hold as the Arab world's most populous state makes a potentially rocky transition to democracy, with no guarantee of the results.
At the White House, President Barack Obama said "Egyptians have inspired us." He noted the important questions that lay ahead, but said, "I'm confident the people of Egypt can find the answers."
The United States at times seemed overwhelmed during the upheaval, fumbling to juggle its advocacy of democracy and the right to protest, its loyalty to longtime ally Mubarak and its fears the fundamentalist Muslim Brotherhood - or more radical groups - could gain a foothold. Mubarak's fall came 32 years to the day after the collapse of the shah's government in Iran, the prime example of a revolution that turned to Islamic militancy.
In Egypt, persecuted democracy activists frequently denounced the U.S. government for not coming down harder on Mubarak's rights abuses. Washington's mixed messages during the crisis frustrated the young protesters. They argued that while the powerful Brotherhood will have to be allowed to play a future political role, its popularity would be diminished in an open system where other ideologies are freed to outweigh it.
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. Anti-Israeli feeling is strong among Egyptians, and a more democratic government may take a tougher line toward Israel in the chronically broken-down peace process. But 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 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 appeared unshakable, it could happen anywhere. Only a month earlier, Tunisia's president was forced to step down in the face of protests.
"This is the greatest day of my life," Nobel Peace laureate Mohammed ElBaradei, whose young supporters were among the organizers of the protest movement, told The Associated Press.
"The country has been liberated after decades of repression," he said adding that he expects a "beautiful" transition of power.
Perhaps most 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 greater awareness and bitterness among Egyptians over issues like police abuse and corruption.
"Facebook brought down the regime," said Sally Toma, one of the main protest organizers.
When the online activists 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 joined in. But far from hijacking the protests as many feared, it often seemed co-opted by the protesters, forced to set aside its hard-line ideology at least for now to adhere to democratic demands.
About 300 people were killed in the course of the turmoil. Police attacked the first protests with water cannons and gunfire and then a force of regime supporters - believed to be paid thugs - assaulted Tahrir trying to dislodge the protesters, only to be beaten back in two days of pitched battles.
Wael Ghonim, a Google Inc. executive who earlier this year secretly created a Facebook page that became a crucial protester organizing forum, said he "went mad" when he heard the news of Mubarak's ouster.
"I expect a bright future. I trust in 80 million Egyptians," Ghonim, who was arrested immediately after the protests began and held for 12 days, told The Associated Press.
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, ensuring control through rigged elections, a constitution his regime wrote, a ruling party that monopolized the levers of state, and a hated police force accused of widespread torture.
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.
Throughout the crisis, Mubarak backpedaled with concessions, replacing his government, purging his ruling party and moving to prosecute some of its most unpopular figures. But the moves did nothing to diminish the regime's power - and did not satisfy the steadily swelling protests.
Up to the last hours, Mubarak sought to cling to power, handing some of his authorities to his newly appointed Vice President Omar 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 flooded the main squares of cities around the nation. Soldiers stood by, even threw cookies and biscuits to protesters who massed in front of Mubarak's palaces in Cairo and Alexandria, chanting for him to go. Others blockaded the towering State Television and Radio Building overlooking the Nile River in Cairo, blocking employees from entering.
Ahmed Kassam, an engineer, said he marched with crowds for two hours across Cairo from Tahrir to the Oruba palace. "We were shouting at people standing in their balconies and they came down and joined us. We have thousands behind us," he said. "Today I feel that something is going to change. I feel very, very powerful."
Protesters stormed the main security headquarters in southern Egypt's main city Assiut, and two were killed by police opening fire before the province's governor was forced to flee, escorted to safety by the army.
The ousted Mubarak himself flew to his isolated palace in the Red Sea resort of Sharm el-Sheikh, 250 miles (400 kilometers) from the turmoil in Cairo.
Suleiman - who appears to have lost his vice president's post as well in the military takeover - appeared grim as he delivered the short announcement on state TV Friday night that Mubarak was stepping down.
"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."
The question now turned to what happens next. Protesters on Friday had overtly pleaded for the army to oust Mubarak. The country is now ruled by the Armed Forces Supreme Council, consisting of the military's top 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 achieve the ambitions of our great nation" and would announce them soon. He praised Mubarak for his contributions to the country. Pointedly, he did not salute his former commander-in-chief. Instead he stood at attention and raised his hand to his cap in a salute to protesters killed in the unrest.
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, then 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."
For the moment, concerns over the next step were overwhelmed by the wave of joy and disbelief - and an overwhelming pride that they had waged a peaceful campaign crowned with success.
In Tahrir Square, the crowds of several hundred thousand watched and listed to Suleiman's speech on televisions and on mobile-phone radios. When he finished, they burst into wild cheers, waving flags and chanting "Allahu akbar," or "God is Great" and "the people have brought down the regime."
Spontaneous lines of dancers threaded through the packed mass of people. One man kissed the ground and thanked God while others screamed, "Hosni is gone, Hosni is gone." Around the capital of 18 million, cars honked their horns in celebration.
"I am 42 years old and my children can finally live in free," said Mahmoud Ghandem, who joined the Tahrir protests five days ago from his Nile Delta town of Kafr el-Sheikh.
Outside the Oruba presidential palace, one man sprawled on the grass in shock amid the cheers. Others handed out sweets and waved their hands in V-for-victory signs. The crowd then began to march in a sea of Egyptian flags back to the protest's heart, Tahrir.
Throughout the night, Tahrir Square and the surrounding downtown streets were transformed into a massive party. Thousands streamed in from across the city, jamming bridges over the Nile. Army checkpoints surrounding the square for days melted away as some soldiers threw themselves into the throngs. In the streets, parents took pictures of their children posing with Egyptian flags.
State television, a bastion of unwavering support for Mubarak, had an almost instant change of tone. After disparaging the protesters as foreign-backed troublemakers for days, it began reporting the celebrations as a victory for freedom. Egyptians, one reporter outside Oruba palace proclaimed, "are able to move the waters that have been still for 30 years."
Ala Moussa, a 24-year-old from Alexandria who came Friday to join the Cairo protests, took off his glasses to wipe away tears. He had been shot by a rubber bullet during earlier protests in his hometown.
"For 50 years, it was a police state and we adapted ourselves to it," he said. "The question now is, can we take another route. I hope so."
AP correspondents Paul Schemm, Ryan Lucas, Hamza Hendawi, Sarah El Deeb, Hadeel al-Shalchi, Tarek el-Tablawy and Maggie Hyde contributed to this report.