Britain voted to leave the European Union, setting in motion a historic divorce that rattled the bloc, raised questions about Scotland’s future in the United Kingdom and unleashed a storm on financial markets.

The vote’s result — 52 percent for Leave and 48 percent for Remain — instantly triggered a global market selloff Friday as the world fretted about the future of London, its biggest financial center.

Political repercussions soon followed. Hours after the final tally, British Prime Minister David Cameron stepped out onto the doorstep of Number 10 Downing Street and announced that he would resign in October.

“It would not be right for me to be the captain that steers our country to the next destination,” said Cameron, whose call for a referendum set the stage for Brexit.

While Cameron's Tory peers are likely to compete for the premiership, former London Mayor Boris Johnson is tipped as his most likely successor. The Brexit campaigner praised Cameron in a speech, saying he would be "remembered as a great prime minister."

On the continent, heads of state and EU officials were left reeling by the result.

In a brief address from Paris, French President François Hollande said the European Union needed to reform itself deeply, while German Chancellor Angela Merkel called for the bloc to maintain close ties to Britain.

"Today is a blow to Europe and a blow to the project of European unity," Merkel said in Berlin. "The future of the EU depends on how well we prove ourselves to be willing and capable of making the right decisions, and not estranging the U.K."

The two leaders announced that they would meet Monday in Berlin with Italian Prime Minister Matteo Renzo to discuss a first response to Brexit -- the biggest political blow to the EU since its founding after World War II.

A summit of all EU leaders is to follow Tuesday in Brussels. European Council President Donald Tusk said he hoped the meeting would be the start of "wider reflection" on Europe's future. The European Parliament announced it would hold a special session on Tuesday to give its members a chance to vote on a resolution "analyzing the outcome and ways forward."

First tensions

The defeat of "Remain," which was well-funded and had the support of U.S. President Barack Obama, handed an unprecedented victory to Euroskeptic politicians across the bloc.

Nigel Farage, leader of Britain’s United Kingdom Independence Party, hailed the result as a “new dawn” for Britain and said June 23 should be known as Britain’s “independence day.” Across the Channel, French far-right leader Marine Le Pen called for a wave of Brexit-style referendums across the bloc.

“I think a process has been set in motion that will lead to the end of the European Union as we know it,” Le Pen, head of the National Front party, said at a news conference in Paris.

Wary of stoking Euroskepticism, EU officials called for restraint after the vote. But, in a sign of how tricky relations between London and the EU may become, Leave campaigners quickly clashed with EU officials over the timeframe of a divorce.

Boris Johnson said there was no rush to settle the terms — a remark quickly contradicted by European Commission President Jean-Claude Juncker, who said that Britain should formally depart the EU “as soon as possible.”

“We now expect the United Kingdom government to give effect to this decision of the British people as soon as possible, however painful that process may be,” read a statement signed by Juncker and other top EU officials.

UK breakup?

While the shock of Brexit reverberated around the world, its impact was felt most immediately in the United Kingdom, where an emotional campaign marred by the murder of pro-Remain Labour MP Jo Cox revealed deep divisions in the voting population.

Analysis voting patterns showed that “Leave” had prevailed thanks to heavy support from older voters and residents of smaller towns. By contrast, voters under 40 and inhabitants of big towns — notably cosmopolitan London — had rallied for Remain.

But no division was as stark as that between England and Scotland, which overwhelmingly voted to remain in the EU.

In a move that could herald the United Kingdom’s breakup, Scottish First Minister Nicola Sturgeon called for a new referendum on her country’s relationship with Britain, less than two years after voters chose to remain in the U.K. in a previous vote.

“The vote makes clear that the people of Scotland see their future as part of the European Union,” Sturgeon said.

One simple question

British voters faced a single question Thursday: “Should the United Kingdom remain a member of the European Union or leave the European Union?” There were two boxes on the ballot paper, “Remain” and “Leave.”

A record 46,499,537 people were entitled to take part, according to figures from the Electoral Commission. The vote capped months of political drama, intrigue and surprises.

It started off calmly enough but soon became nasty, so nasty that it took a tragic event — the killing of Cox — to alter the course of the fight, forcing a halt to the campaigns and a softening of the rhetoric.

The library in Birstall, West Yorkshire, where Cox was shot and stabbed, was used as a polling station Thursday and hosted a lunchtime vigil for the murdered politician.

In London, two polling stations had to be moved as the equivalent of a month’s worth of rain fell through the night into Thursday morning. The rain did not appear to have deterred voters, many of whom faced long waits to cast their ballot.

This was only the third nationwide referendum in British history. The last one took place five years ago, when voters rejected an attempt to change the way MPs are elected. The first one was in 1975, when voters were asked if the U.K. should continue to be a member of what was then the European Economic Community.