European leaders went into crisis mode Friday after the surprise vote by Britain to exit the European Union, locking themselves inside emergency meetings even as nationalists across the region issued rallying cries to follow in London’s footsteps.

From Dublin to Paris to Berlin, governments confronted their worst-case scenarios and scrambled to form a consensus on how to now extricate Britain from the 28-nation bloc as British Prime Minister David Cameron said he planned to step down in defeat. Top leaders of the E.U.’s executive and legislative branches, meanwhile, met Friday morning in Brussels. E.U. ambassadors — all 28 of them, for now — convened in the afternoon in Luxembourg. Foreign ministers from the six founding E.U. nations were set to meet in Berlin on Saturday.

The flurry of diplomacy was laying the groundwork for a previously planned E.U. summit on Tuesday, when talks on how to handle what could be a painful, messy process of a British exit are set to start. Cameron said he did not plan to immediately trigger the clause of the European treaty that would start up to two years of exit negotiations.

He indicated that he would leave exit decisions to his successor.

Even as key political figures reacted with shock — “Damn! It’s a sad day for the E.U.,” tweeted German Vice Chancellor Sigmar Gabriel — others cautioned that it was now up to the E.U. to prove its worth to the people of the continent. The E.U., critics say, has veered too far from its initial concept as a customs and economic union, meddling in national budgets and labor laws while being viewed as a remote bureaucracy by many across the region it serves.

German Chancellor Angela Merkel, who bears most of the burden of holding the E.U. together, called Britain’s departure a “turning point in Europe and of European integration” and offered an impassioned plea for the rest of the bloc to stick together. She also called for swift but fair breakup negotiations with London that maintain Germany’s partnership with “as closely as possible.”

The rest of the E.U. nations, she said, should not forget that at the core of the bloc was a mission greater than economics or politics. She called for the remaining states to stick together in globalized times.

With a nod to history, she emphasized that Germany has a “responsibility” to ensure Europe’s peaceful future with or without Britain in the E.U.

“We should never forget, especially in these times, that the idea of the European Union was an idea of peace,” she said. “After centuries of most terrible bloodshed, the founders of the European integration found the way to reconciliation.”

E.U. leaders now face the challenge not only of managing the mechanics of a British exit but also of making the bloc feel more relevant to the region’s grass roots, in order to ensure its survival.

After Britain voted to leave the E.U., European Council President Donald Tusk said the bloc is "determined to keep its unity." (European Council)

Meanwhile, Austrian foreign minister Sebastian Kurz told state broadcaster ORF on Friday that “a domino effect on other countries can’t be ruled out.”

Donald Tusk, president of the European Council, said E.U. law will still apply in Britain until it officially leaves. He said he had spoken to the region’s leaders and would seek continued European unity.

But he conceded that reflection on the future of the bloc was needed.

“I have proposed to the leaders that we consider a wider reflection on our union,” he said. “These last years have been the most difficult in the history of our union. . . . But what doesn’t kill you makes you stronger.”

Amid sharp falls in both the British pound and the euro, many Europeans acknowledged that the path ahead would be hard.

“The United Kingdom . . . will go its own way,” Martin Schulz, president of the European Parliament, told German public broadcaster ZDF. “I think the economic data show this morning that it will be a very difficult way.”

Anti-E.U. forces across Europe, for their part, were jubilant. Nationalists on the continent, including in Sweden and Denmark, immediately called for similar referendums. In the Netherlands, right-wing leader Geert Wilders, already rising in the polls there, lauded the British vote.

“Hurrah for the British! Now it is our turn. Time for a Dutch referendum!” he tweeted under the hashtag #ByeByeEU.

In France, Marine Le Pen, eyeing next year’s presidential race as the leader of the French anti-E.U. National Front party, vowed to pursue a referendum on “Frexit” — or a French exit — as a campaign pledge.

“Victory for liberty! As I have demanded for years, it is now time to have the same referendum in France and in E.U. countries,” she wrote on Twitter.

Donald Trump, the presumptive Republican presidential nominee, also hailed the British vote. Britons “took back their country,” he told reporters during a business-focused trip to one of his golf resorts in Scotland. “That’s a great thing.”

Britain may face tough terms for an exit and may struggle to withdraw — as many exit supporters suggested — while still maintaining free access to the 27 other nations that form the world’s largest integrated consumer market. The E.U. stance, as with many major decisions, will come down largely to the positions of Germany and France, which are likely to drive a hard bargain with London to discourage domestic copycats.

“We respect the result of the British referendum,” German Finance Minister Wolfgang Schäuble told reporters in Berlin. “I would have wished for a different result. Now we have to look forward and deal with this situation.”

Stephanie Kirchner in Berlin and Andrew Roth in Moscow contributed to this report.