Updated 9:42 a.m. ET

Voters in the U.K. have decided to leave the European Union, a decision that has shocked Europe, shaken global markets and pushed Prime Minister David Cameron to announce his upcoming resignation.

The EU referendum vote was decisive — 52 percent to 48 percent in favor of dissolving the United Kingdom's 43-year membership in the European community. But Northern Ireland and Scotland voted in favor of remaining, raising the specter that the United Kingdom itself may break apart.

Cameron announced he will resign before his Conservative Party conference in October.

"I was absolutely clear about my belief that Britain is stronger, safer and better off inside the European Union," Cameron said Friday. "But the British people have made a very clear decision to take a different path, and as such I think the country requires fresh leadership to take it in this direction."

The process of leaving the EU will likely take many years of negotiations.

In the meantime, it's a period of "tremendous uncertainty" for the U.K. and Europe, NPR's Peter Kenyon reports from London. And the fiery rhetoric that marked the debate over the referendum hasn't ended now that the results are in.

"The EU's failing, the EU's dying," said Leave campaigner Nigel Farage, the head of the U.K. Independence Party, after the official results were announced. Farage said he anticipates the Netherlands and Denmark will follow Great Britain out of the European Union.

The value of the British pound plunged; at one point Friday it was lower against the U.S. dollar than it has been at any point since 1985.

Global stock markets also plummeted as the vote counts trickled in Thursday night and Friday morning. NPR's John Ydstie notes, however, that markets had been up based on the erroneous belief that the U.K. would opt for "remain" — so the sharp decline actually returns markets to approximately where they were a week ago. Gold, meanwhile, went up.

In U.K., Elation, Surprise And Uncertainty

Opinion polls showed a tight race, with the final poll — as well as the betting markets and the financial world — anticipating the U.K. would vote "Remain." That meant for many in the U.K. and around the world, the referendum's outcome came as a shock.

The results showed sharp regional divisions in the United Kingdom. London, Scotland and Northern Ireland had strong pro-EU results, while rural and economically depressed areas backed the so-called Brexit in large numbers.

NPR's Frank Langfitt says that in London today, people who wanted to remain in the EU are both disappointed and "very surprised."

"People who wanted out are elated," he said. "There's one woman I talked to who actually screamed."

Jeremy Corbyn, leader of the opposition Labour Party, said voters were reacting to decades of mistreatment by successive governments.

"Many communities are fed up with cuts, fed up with economic dislocation and feel very angry at the way they've been betrayed and marginalized," Corbyn said.

Anger over immigration was a potent force among the "Leave" camp, Frank says.

Many voters who opted out of the EU "felt that the price of immigration was just too high, that it was driving down wages, costing people jobs," he says. "With some white Britons, there was a feeling also that the immigration was changing the nature of communities here."

Many voters also distrusted the experts and powerful leaders urging voters against the Brexit, Frank says:

"The rest of the world, for what it's worth, was telling the Brits not to do this. Economists almost uniformly were against this; they said it would damage the British economy and the global economy. Political leaders from Xi Jinping in China to Barack Obama said this would make Britain less relevant. But the voters — to some degree, I think, tired of being told what to do by the elites — made up their minds."

As U.K. Breaks Off, Might It Break Apart?

Northern Ireland's strong Remain vote led Sinn Fein chairman Declan Kearney to call for a referendum on unification with Ireland, an EU member country. Sinn Fein is the largest Irish nationalist party in Northern Ireland.

Northern Ireland's deputy first minister, nationalist Martin McGuinness, said holding such a vote is "a democratic imperative."

Pro-British First Minister Arlene Foster, meanwhile, said there was "no way" such a vote would result in a united Ireland.

Scotland, too, may be eyeing a split with the U.K. — again. A 2014 referendum on Scottish independence resulted in the country remaining within the United Kingdom.

But now that the U.K. will be leaving the EU, a second referendum may be in the works. Scotland's voters preferred "Remain" over "Leave," by 62 percent to 38 percent.

Scottish First Minister Nicola Sturgeon says the result is Scotland being pulled out of Europe against its will.

"I regard that as being democratically unacceptable," she said Friday. "It's a statement of the obvious that a second referendum [on independence] is on the table."

In Europe, 'Complete Shock'

The United Kingdom is (or was, until the pound crashed) the second-largest economy in the EU, and the referendum comes as a blow to the continent.

"I think there was complete shock this morning when people woke up," says NPR's Soraya Sarhaddi Nelson, reporting from Berlin. "Like most Europeans, everybody here thought they would wake up to the U.K. still being in the EU.

"It's unusual here to have a quick reaction from officialdom, but there actually was some reaction," she says. "The vice chancellor I think summed it up for all when he tweeted, 'Damn, a bad day for Europe.' "

Current EU president Donald Tusk said the group is "determined to keep our unity at 27," referring to the number of member nations minus Great Britain. He went on to say, quoting his father, "What doesn't kill you makes you stronger."

The EU assembly will hold an emergency session next week in the wake of the news, The Associated Press reports. The referendum's results will also be the top item on the agenda for an upcoming summit of EU leaders in Brussels.

Germany's foreign minister, Frank-Walter Steinmeier, tweeted the vote was "a sad day for Europe and Britain." France's foreign minister, Jean-Marc Ayrault, said he was "sad for the United Kingdom."

Poland's foreign ministry, meanwhile, called it a "warning signal" of "disillusionment with European integration," the AP reports. Hungary's prime minister, Viktor Orban, said the vote pivoted on the question of immigration and signaled the importance of Brussels listening to the "voice of the people" in member states. Anti-immigration sentiment has been playing a central role in politics within both countries.

Euroskeptic parties in Sweden and Denmark called for EU membership referenda in their own nations, the AP writes, as did far-right leader Marine Le Pen in France.

As for what happens next: NPR's Peter Kenyon explains there is a two-year window for the U.K. and the EU to come to an agreement over the terms of its departure from Europe.

As Peter noted earlier, some members of the "Remain" camp have worried that a Brexit would give the EU an incentive to keep other member states from fleeing: "Therefore, the argument goes, they would offer the U.K. very poor exit terms — such as drastically limiting the U.K.'s access to the EU single market — as a warning to other states."

In U.S., Economic Effects And Political Echoes

While laws and policies in the U.K. aren't changing immediately, the impact of the Brexit on the rest of the world, including the U.S., has already begun.

The British pound is one of the world's stable "reserve" currencies, and it's fallen precipitously in value. Markets, too, have contracted. On Friday morning, the Dow opened and immediately dropped approximately 500 points.

"I think over the long term for the United States, it's going to mean a little bit slower economy," reports NPR's John Ydstie. "It means a stronger dollar, which is going to hurt exports. It also means that our trading partners, like the EU and the U.K., are going to go through a period of uncertainty and their growth could be hampered — so, again, exports to those countries could be hurt."

As NPR's Marilyn Geewax has previously reported, there's also the risk of a domino effect of exits — whether Scotland leaving the U.K. or more countries leaving the EU. Either would cause political instability, "as well as disruptions in flows of labor, capital and commerce," Marilyn writes, "harming U.S. business dealings."

"But some conservatives say Brexit would spur growth by freeing the U.K. from regulatory overreach by EU bureaucrats," Marilyn notes.

And, John says, "I guess the silver lining to this cloud is that if you're taking a trip to the U.K. this summer for a vacation, your dollar is going to go a little bit further."

Meanwhile, many observers are noting the similarities between the politics over the referendum and the U.S. presidential election.

Tony Travers, a professor at the London School of Economics, spoke with NPR's Frank Langfitt after the referendum results were announced.

"I think the lesson is, in part, a traditional one: a disconnect between political elites as they're called — people who run the government and the financial system and so on — and most other people," Travers said. "And, you know, in the United States the rise of Donald Trump and Bernie Sanders, I think, is evidence of a similar phenomenon."

Trump, the presumptive Republican nominee, is currently in the U.K. visiting the Trump Turnberry golf course.

Although he was in Scotland — which, again, overwhelmingly voted to remain in the EU — Trump tweeted that the "place is going wild over the vote. They took their country back, just like we will take America back."

Speaking at his golf course in Scotland, he said people are angry, which fueled the Brexit vote. He also said the weaker pound will help business at the golf course.

In a statement, Trump said Americans, too, will have an opportunity to "re-declare their independence" and "reject today's rule by the global elite," and said he hoped America is watching.

President Obama issued a statement Friday morning, saying "the people of the United Kingdom have spoken, and we respect their decision."

Copyright 2016 NPR. To see more, visit http://www.npr.org/.