CAIRO (AP) – Egypt’s Hosni Mubarak resigned as president and handed control to the military on Friday after 29 years in power, bowing to a historic 18-day wave of pro-democracy demonstrations by hundreds of thousands. “The people ousted the president,” chanted a crowd of tens of thousands outside his presidential palace in Cairo.

Several hundred thousand protesters massed in Cairo’s central Tahrir Square exploded into joy, cheering and waving Egyptian flags. Fireworks, car horns and celebratory shots in the air were heard around the city of 18 million in joy after Vice President Omar Suleiman made the announcement on national TV just after nightfall.

Mubarak had 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 soliders stood by, besieging his palace 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.

It was the biggest day of protests yet in the upheaval that began Jan. 25, growing from youth activists working on the Internet into a mass movement that tapped into widespread discontent with Mubarak’s authoritarian lock on power, corruption, economic woes and widespread disparities between rich and poor.

“In these grave circumstances that the country is passing through, President Hosni Mubarak has decided to leave his position as president of the republic,” a grim-looking Suleiman 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 suporters 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.

Outside Mubarak’s Oruba Palace in northern Cairo, women on balconies ululated with the joyous tongue-trilling used to mark weddings and births.

“Finally we are free,” said Safwan Abo Stat, a 60-year-old in the crowd of protesters at the palace. “From now on anyone who is going to rule will know that these people are great.”

Another, Mohammed el-Masry, weeping with joy, said he had spent the past two weeks in Tahrir before marching to the palace Friday. He was now headed back to the square to join his ecstatic colleagues. “We made it,” he gasped.

The question now turned to how the military, Egypt’s most powerful institution, will handle the transition in power. Earlier in the day, the Armed Forces Supreme Council–a body of top generals–vowed to guide the country to greater democracy.

In a statement hours before Suleiman’s announcement, it said it was committed “to sponsor the legitimate demands of the people and endeavor for their implementation within a defined timetable … until achieving a peaceful transition all through a democratic society aspired by the people.”

Abdel-Rahman Samir, one of the youth organizers of the protests, said the protest movement would now open negotiations with the military over democratic reform 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 yera and a half and now we are now finally sowing the fruits.”