President Hosni Mubarak resigned and handed power to the military on Friday, and Egypt held its biggest party in decades.
"The people have toppled the regime," chanted protesters, whose 18 days of swelling protests tipped Egypt into a crisis that the autocratic government could not undo.
"This is the happiest day in my generation," said Ali al-Tayab, a demonstrator who paid tribute to those who died in clashes with police and Mubarak supporters. "To the martyrs, this is your day."
At a presidential palace in Cairo, where demonstrators had gathered in the thousands, people flashed the V-for-victory sign and shouted, "Be happy, Egyptians, today is a feast" and "He stepped down."
They handed out candy. Many prayed and declared: "God is great."
Crowds packed Tahrir Square, the scene of massive protests against Mubarak that began on Jan. 25. The celebrations continued early Saturday, with throngs of people milling around in downtown Cairo.
A huge poster hanging in the square read, "Breaking news: The people have brought down the regime."
"Egypt is free," shouted Mahmoud Elhetta, a protest organizer. "We are a great people and we did something great. This is the expected end for every dictator."
Some, though, warned that Egypt still faces many challenges, including what they hope will be a peaceful transition to free elections and a full democracy.
"We still have a long way to go to fix things," said protester Hala Abdel-Razek. "What has been ruined by the Mubarak regime has to be fixed and we have to start rebuilding with the help of the young people."
A speaker on a podium said demonstrators would not immediately abandon the square because: "There is more to do."
Some soldiers who were stationed at the square ran into the crowd to celebrate, and protesters lifted them onto their shoulders. Other troops stayed at their posts, watching the scene in awe. People posed with them for photographs in front of tanks. Flag-waving children climbed onto the vehicles.
The protesters' barricades that had controlled entry to the square were dismantled, and security checkpoints at which demonstrators showed identification and had their bags searched were also gone.
On Thursday, an exultant crowd gathered on the square for what they expected would be the president's televised announcement that he would resign. Instead they were shocked to hear him say he would transfer power to his deputy, but keep the title. Angry and disappointed, thousands of protesters fanned out across the city on Friday.
Vice President Omar Suleiman then announced that his boss had resigned.
In Tahrir Square, protesters heard the announcement on mobile telephone radios that they passed back and forth. They broke into cheers and some formed a conga line, winding through the packed area.
"Goodbye, Goodbye," demonstrators shouted. They beat drums and waved national flags.
"Finally, we are free," said 60-year-old Safwan Abou Stat. "From now on, anyone who is going to rule will know that these people are great."
In some neighborhoods, women on balconies ululated with the joyous tongue-trilling used to mark weddings and births. Others sang the national anthem.
State television, a bastion of support for the Mubarak regime, began reporting the celebrations across the nation. It was a big change for state television, which had spent most of the last days of the uprising trying to portray the demonstrators as a minority.
Mubarak's departure, said the station's reporter outside his Cairo palace, "showed that the Egyptians are capable of making their own history. They are able to move the water that has been still for 30 years."
"At this moment, Egyptians are breathing freedom," said the TV presenter.
The mood of several hundred thousand protesters who had earlier gathered outside the presidential palace of Ras el-Tin in coastal Alexandria and the downtown area broke into celebration on hearing of Mubarak's resignation. They waved flags, whistled and danced.
People in the southern city of Assiut fired guns in the air as they roamed the streets on motorcycles or pickup trucks. Coffee houses distributed free sweet drinks to anyone who walked by.
Earlier in the day, two protesters were killed in a clash with security forces there, and crowds set a police station on fire. The army evacuated the local governor to the military headquarters in southern Egypt.
Hundreds of miles away, in the restive Sinai Peninsula city of al-Arish, celebrations over Mubarak's departure began as a gunbattle continued between a group of residents and security forces outside a police station.
The head of northern Sinai's health services, Sami Anwar, said two people have been killed and 35 wounded in the fighting.
The gunbattle erupted when the residents tried to storm the police station, the latest violence in a long dispute over what residents see as the heavy-handed tactics of the police.
In Cairo, in the midst of the celebration, Ala Moussa said he was shot in the back by a policeman's rubber bullet at an earlier protest. He removed his glasses and wiped away tears.
"We have our freedom now," he said. "The question now is if we can take another route. I hope so."
Mohammed el-Masry, who marched to the presidential palace, said he had spent the past two weeks living in the protest encampment at Tahrir Square. He also wept.
"We made it," he said.
Associated Press writers Paul Schemm, Maggie Michael and Ryan Lucas contributed to this report.