LONDON — Britain voted to leave the European Union, a historic decision sure to reshape the nation’s place in the world, rattle the Continent, and rock political establishments throughout the West.
With 309 of 382 of the country’s cities and towns reporting early on Friday, the Leave campaign held a 52 percent to 48 percent lead. The BBC called the race for the campaign shortly before 4:45 a.m., with 13.1 million votes having been counted in favor of leaving and 12.2 million in favor of remaining.
The value of the British pound plummeted as financial markets absorbed the news. Stocks fell sharply on the Asian markets, with the Nikkei average down 7.5 percent in mid-day trading.
Despite opinion polls ahead of the referendum that showed either side in a position to win Thursday, the outcome stunned much of Britain, Europe, and the trans-Atlantic alliance, highlighting the power of anti-elite, populist, and nationalist sentiment at a time of economic and cultural dislocation.
“Dare to dream that the dawn is breaking on an independent United Kingdom,” Nigel Farage, the leader of the UK Independence Party, one of the primary forces behind the push for a referendum on leaving the European Union, told cheering supporters.
Britain will become the first country to leave the 28-member bloc, which has been increasingly weighed down by its failures to deal fully with a succession of crises, from the financial collapse of 2008 to a resurgent Russia and the massive influx of migrants the past two years.
The result left Prime Minister David Cameron, who led the charge for Britain to remain a member of the European Union, at risk of losing his job. It was a remarkable victory for the country’s anti-European forces, which not long ago were considered to have little chance of prevailing.
Financial markets, which had been anticipating that Britain would vote to stay in, braced for a day of losses and possible turmoil.
Economists had predicted that a vote to leave the bloc could substantially damage the British economy.
Cameron had vowed before the vote to move quickly to begin the divorce process if Britain voted to leave. But even if he follows through — some leaders of the Leave movement have counseled moving slowly — nothing will change immediately on either side of the Channel, with existing trade and immigration rules remaining in place.
The withdrawal process is expected to be complex and contentious, though under the bloc’s governing treaty it is effectively limited to two years.
For the European Union, the result is a disaster, raising questions about the direction, cohesion, and future of a bloc built on liberal values and shared sovereignty that represents, with NATO, a vital component of Europe’s postwar structure.
Britain is the second-largest economy after Germany in the European Union, a nuclear power with a seat on the UN Security Council, an advocate of free-market economics, and a close ally of the United States.
The loss of Britain is an enormous blow to the credibility of a bloc already under pressure from slow growth, high unemployment, the migrant crisis, Greece’s debt woes, and the conflict in Ukraine.
“The main impact will be massive disorder in the EU system for the next two years,” said Thierry de Montbrial, founder and executive chairman of the French Institute of International Relations. “There will be huge political transition costs, on how to solve the British exit, and the risk of a domino effect or bank run from other countries that think of leaving.”
Europe will have to “reorganize itself in a system of different degrees of association,” said Karl Kaiser, a Harvard University professor and former director of the German Council on Foreign Relations. “Europe does have an interest in keeping Britain in the single market, if possible, and in an ad hoc security relationship.”
While leaders of the Leave campaign spoke earnestly about sovereignty and the supremacy of Parliament or in honeyed tones about “the bright sunlit uplands” of Britain’s future free of Brussels, it was anxiety about immigration — membership in the European Union means freedom of movement and labor throughout the bloc — that defined and probably swung the campaign.
With net migration to Britain of 330,000 people in 2015, more than half of them from the European Union, Cameron had no effective response to how he could limit the influx. And there was no question that while the immigrants contributed more to the economy and to tax receipts than they cost, parts of Britain felt its national identity was under assault and the influx was putting substantial pressure on schools, health care, and housing.
The campaign run by one of the loudest proponents of leaving, the UK Independence Party, flirted with xenophobia, nativism, and what some of its critics considered racism. But the official, more mainstream Leave campaign also invoked immigration as an issue and its slogan, “Take control,” resonated with voters.
Other anti-establishment and far-right parties in Europe, such as the National Front of Marine Le Pen in France, Geert Wilder’s party in the Netherlands, and the Alternative for Germany party, will celebrate the outcome.
The depth of anti-Europe sentiment could be a key factor in national elections scheduled next year in the other two most important countries of the European Union, France and Germany.
The British campaign featured assertions and allegations tossed around with little regard to the facts. Both sides played to emotion, and the most common emotion played upon was fear.
The outcome is a crippling blow to Cameron, who had cast the referendum as a choice between an insular, intolerant ‘‘little England,’’ and an outward-looking, pluralistic Great Britain.
Having failed to convince a majority of voters on such a fundamental issue, he is expected to come under intense pressure to resign.
Material from the Washington Post was used in this report.