This drift helps to explain how as part of their victory in the general election this month Boris Johnson and the Conservatives were able to capture “red wall” districts — the coal and factory towns in the Midlands and north of England that until now voted as reliably for the Labour Party as blue-collar precincts in the American Midwest once voted for the Democrats.

Why is this happening? The popular answer on the left is that this is about economic insecurity, economic globalization and imports from China. But when you zoom in to look not just at areas but individual voters, attitudes toward immigration are in fact the strongest predictor of support for Brexit.

Britons’ anxieties about the pace and scale of immigration, something that Mr. Johnson pledged to restrict, lie at the heart of Britain’s political realignment; many voters are now putting their cultural preferences ahead of their once-tribal party political identities.

The immigration attitudes of individuals strongly predict attitudes toward Brexit. Liberalism on immigration correlates with the share of university graduates and, to some extent, the proportion of young voters in a constituency.

Left-wing and progressive parties are increasingly made up of whites inclined toward difference and change, as well as ethnic minorities. The right is increasingly made up of whites who tend to view difference as disorder, and change as loss.

“Fast versus slow” is a better framework for understanding this than “open versus closed.” Mr. Johnson and the Conservatives have tapped into this strong feeling of cultural insecurity and anxiety over rapid social change; Labour, by promising to uphold the free movement of European Union nationals and large-scale immigration, merely offered more of the same.

Another important dynamic is occurring in Britain, as it is throughout the West: the ethnic sorting of the electorate.