CAIRO — Egypt exploded with joy, tears, and relief after pro-democracy protesters brought down President Hosni Mubarak with a momentous march on his palaces and state TV. Mubarak, who until the end seemed unable to grasp the depth of resentment over his three decades of authoritarian rule, finally resigned Friday and handed power to the military.“The people ousted the regime,” rang out chants from crowds of hundreds of thousands massed in Cairo’s central Tahrir 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 burst into pandemonium. They danced, chanted “goodbye, goodbye,” and raised their hands in prayer as fireworks and car horns sounded after Vice President Omar Suleiman made the announcement on national TV just after nightfall.“Finally we are free,” said Safwan Abou 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.”The protests have already echoed around the Middle East, with several of the region’s autocratic rulers making pre-emptive gestures of democratic reform to avert their own protest movements. The lesson many took: If it could happen in three weeks in Egypt, where Mubarak’s lock on power had appeared unshakable, it could happen anywhere.