It’s not only about economics; there is a cultural dimension, too. In the last election, nearly four million mainly white working-class retirees abandoned the mainstream in favor of the U.K. Independence Party, a stridently euroskeptic populist party. The rise of UKIP, which campaigns as hard against an influx of European workers as it does for withdrawal from Europe, is a register of how immigration has moved to the forefront of Britain’s debate.

Then came the refugee crisis. Combined with angst over migrant camps near Calais, France, where hundreds are trying to enter Britain, recent headlines have pushed public anxiety about immigration to the highest level ever recorded. It is now voters’ top priority, with nearly twice as many voicing concern over immigration as the economy.

Much of this was a long time coming, among an electorate that has never warmed to demographic change. Some of the sentiment is wrapped up with public anger over the failure of the Conservative government to fulfill its pledge, dating from the 2010 election, of reducing net migration to just “tens of thousands” a year. The most recent figure available put net migration into Britain at an annual record high of 330,000.

Such trends have dealt the euroskeptics — who earlier this year were writing off their chances of winning the referendum — a strong hand. Some now believe they can turn the vote on European Union membership into a plebiscite on immigration and securing national borders.

Britain’s prime minister, David Cameron, finds himself in a difficult position. His reluctance to match the commitment of some other European member states to receive refugees — he has promised to resettle only 20,000 over five years — is broadly in line with public opinion. But this risks eroding his political capital in Europe as he tries to renegotiate the terms of Britain’s membership, before returning to the people for the vote.

Europe’s leaders are distracted from efforts to prevent a Brexit, and given Britain’s stance on the refugee crisis, they are unlikely to feel sympathy for Mr. Cameron’s requests to curb welfare benefits for migrant workers from the European Union. Unless he extracts something from the renegotiation that addresses public concern over the free movement of labor — long seen by other states as a pillar of the European project — a Brexit will start to look probable, rather than merely possible.

The political context has also changed. Last weekend brought the shock election of the radical left-winger Jeremy Corbyn as leader of the Labour Party — ushering in a new ambivalence toward Europe among the parliamentary opposition. Mr. Corbyn has said that he cannot see himself campaigning for a Brexit, but he reiterated his desire for a “social Europe” that protects workers’ rights and the environment, rather than a free-market one. Angered by the European Union’s treatment of Greece and a perceived democratic deficit within its core institutions, and concerned that workers’ rights might be watered down, other left-wingers and some trade unions have actually suggested that they could campaign for a Brexit.