LONDON — Fireworks and celebratory gunfire rang out in Tunisia and Lebanon, South Africans recalled Nelson Mandela’s euphoric release from prison and two words – “Congrats Egypt” – dominated social media sites as the world cheered the ouster of Egypt’s Hosni Mubarak.

European officials today saluted the resilience of the demonstrators in Cairo – who mobbed the capital for 18 days to demand their rights despite attacks from pro-government thugs – and pledged assistance to help Egypt transition to democracy.

“In their eyes, you can see what power freedom can have,” German Chancellor Angela Merkel said of the protesters, adding that, by stepping down, Mubarak had rendered “a last service to the Egyptian people.” Merkel herself had lived under another autocratic regime, growing up behind the Iron Curtain in East Germany.

But mixed with the messages of hope were expressions of concern for the future of a critical partner in the Middle East peace process – and guilt over the close partnership that many countries in the West shared with Mubarak’s regime.

Merkel also sounded a cautionary note, expressing hope that whoever comes to power works to “uphold peace in the Middle East and respect the treaties concluded with Israel.”

Whatever the uncertainty, euphoria ruled the streets. In Tunisia, whose people-powered revolution pushed dictator Zine El Abidine Ben Ali into exile just last month and sparked the Egyptian protests, cries of joy and a thunderous honking of horns greeted the news that Mubarak had stepped down.

In Beirut, fireworks and celebratory gunfire erupted over the capital only moments after Egyptian Vice President Omar Suleiman made the announcement that Mubarak had handed power over to the military.

In the West African nation of Mauritania, pedestrians and cars filled the streets of the capital of Nouakchott to celebrate.

In South Africa, officials applauded the resignation – and noted that it happened exactly 21 years to the day after Mandela’s historic release from prison.

“One can’t escape the symbolic importance of this day and the release of Mandela and how that ushered in a new process for South Africa,” said Ayanda Ntsaluba, the director general of South Africa’s foreign affairs department. “Let’s hope this happy coincidence will also one day make the Egyptian people look back and say this indeed was the beginning of better times in Egypt.”

U.S. Vice President Joe Biden called the resignation a “pivotal moment in history” and said the transition taking place must be irreversible and lead to democracy in Egypt. President Barack Obama, whose country has long maintained close ties to Mubarak and his regime, held off from making an immediate comment, to the surprise of many.

The Swiss government immediately froze any assets belonging to Mubarak or his family in Switzerland and blocked the sale of any real estate.

“(The government) wants to avoid any risk of misappropriation of state-owned Egyptian assets,” the Foreign Ministry said.

Some European and U.S. officials have expressed concern that instability in Egypt could throw the peace process between Israelis and Palestinians into chaos – and provide an opening for Islamist forces such as Egypt’s Muslim Brotherhood. Many are also worried that the military takeover may not necessarily spell an end to the rights abuses perpetuated during Mubarak’s nearly three decades in power.

Foreign Minister Radek Sikorski of Poland, whose own nation threw off repressive communist rule 21 years ago, said the changes sweeping Egypt “create both hope and anxiety.” Amnesty International’s Secretary General Salil Shetty agreed, saying that Mubarak’s departure “is not the end.”

“The repressive system that Egyptians have suffered under for three decades has not gone away and the state of emergency remains in place,” he said.

The sentiment was shared across Europe, whose leaders had increasingly pushed Mubarak to make a dramatic move to open up Egyptian society. British Prime Minister David Cameron said Egypt “now has a really precious moment of opportunity” to reform its government. His Foreign Secretary, William Hague, warned against backsliding.

“Any attempt to turn the clock back would be deeply damaging to Egypt’s stability and cohesion and to its standing in the world, and would be met by condemnation,” he said.

In a message posted to Twitter, Turkish Foreign Minister Ahmet Davutoglu said: “Congratulations to the Egyptian people.” His words were matched by a flood of support on the micro-blogging site, where the words “Congrats Egypt” were among the micro-blogging sites most popular terms.

Mubarak’s departure also gave some the opportunity to reflect on the international community’s close ties to his autocratic regime and its reputation as a pillar of stability in the troubled region.

“Mubarak’s tyranny was typical across the region and it is Europe’s shame that we sustained them,” said Edward McMillan-Scott, the European Parliament’s vice president for democracy and human rights.

Noureddine Mezni, an African Union spokesman, call Mubarak’s resignation “historic,” adding that he hoped Egypt would emerge “a stronger and more stable nation.” But he could not say what steps the 53-nation AU would take next as Egypt tries to shift toward democracy.

Mubarak’s departure also came 32 years to the day after the collapse of the shah’s government in Iran – and one academic said Arab governments should not ignore this seismic shift in the old world order.

“This is the popular demonstration that proves any leader can be toppled,” said Eugene Rogan, the director of the Middle East Center at St. Antony’s College in Oxford. “For all the other rulers in the region, it’s a very sobering moment.”