LONDON — Brexit delivered a political earthquake, the tremors of which will be felt for generations. Within only a matter of days Britain voted to end its membership of the European Union, saw its currency slump to a 31-year low, watched the prime minister resign, revived an old constitutional crisis in Scotland and triggered a new one in Northern Ireland, and looked on as the main opposition Labour Party spiraled into a full-blown crisis.

As one journalist quipped the day after the referendum: "It’s been a rather strange day. The prime minister has resigned and it’s only our third most important story."

How could Euroskeptics — who had been consistently underestimated — defeat the Remain camp by nearly 4 percentage points or 1.3 million votes? The difference between the two sides was even more pronounced in England where Leave won by nearly 7 points.

It would be a mistake to view this as primarily a judgment on Britain's relationship with Europe or a simplistic verdict on the preceding referendum campaign. Instead, voting patterns give full expression to deeper divides that have been bubbling away under the surface of British politics for decades, and which are also visible in other Western democracies. The Remain campaign's miscalculation was to fail to grasp them.

The Remain camp should have made a positive case for Britain’s EU membership. Instead, it focused the campaign on the negatives of Brexit.

The town that gave the strongest support for Brexit was the small, East Midlands port of Boston where 76 percent voted to leave the EU. Boston — which also delivered the highest support for UKIP in the 2014 European Parliament elections — offers insight into Brexit heartlands.

The town, which has experienced significant migration from Central and Eastern Europe, is also noticeable for economic deprivation. The median income in Boston is less than £17,000 and one in three people have no formal qualifications at all.

Filled with disadvantaged, working-class Britons who do not feel as though they have been winning from European integration, immigration, and globalization, life in Boston contrasts sharply with that in the area that returned the strongest vote for Remain, the London borough of Lambeth. Here, where 79 percent voted to remain in the EU, life is remarkably different. Compared to Boston, there are more than twice as many professionals, nearly twice as many 18- to 30-year-olds and fewer than half as many working-class voters, pensioners and people with no qualifications. The average voter in Lambeth earns nearly £10,000 more each year than the average voter in Boston.

Voting patterns in other heartlands for Remain and Leave paint a picture of a country sharply divided along three dimensions: social class, generation, and geography.

On average, for example, across the 20 authorities where support for remaining in the EU was strongest, 45 percent of voters have a university degree, 42 percent are professionals, 26 percent describe themselves as "non-white," only 11 percent are pensioners and the median income is £27,000. But across the 20 authorities where support for leaving the EU was strongest, only 16 percent of voters have a degree, only 23 percent are professional, less than 5 percent are non-white, nearly 20 percent are pensioners and the median income is £18,000.

My academic research suggested that the Remain camp would be best placed making a positive case for Britain’s EU membership. Instead, it spent almost all of the campaign focusing on the negatives of Brexit, robotically claiming leaving the EU would jeopardize Britain's economic future. The problem was that most economically disaffected voters who were tempted by Brexit were already resigned to believing that their future would be worse than the past. And they were clear about who was to blame.

Brexit drew most of its strength from voters who have felt left behind by the rapid economic transformation of Britain, or more accurately of London and south-east England. They hold a more socially conservative outlook on Europe, immigration, and national identity that in recent years have become just as important as old disputes between labor and capital.

Brexit owed less to personal charisma than to a deep sense of angst, alienation and resentment among the financially disadvantaged

Such voters have also felt increasingly cut adrift from established parties who have spent much of the past two decades pitching to the middle-classes. Tony Blair and David Cameron both gambled in their own ways that as they battled to win over the middle-classes, the more working-class sections of their electorates would stay loyal. But then along came the issues of Europe and immigration that cut directly across the old left-right divide and were instead rooted in a divide between liberals and authoritarians.

This presented blue-collar workers on the left and social conservatives on the right with a unique opportunity to rebel against socially liberal and middle-class elites who promote values that they abhor. Last week they seized this opportunity.

By voting for Brexit these voters imposed a different set of values on the political landscape than those that unite the London-centric media and political classes. As my co-author Robert Ford noted after the result: "Feeling upset by wrenching social change that has been imposed on you by people whose values you don’t share or understand? Now you know how UKIP voters have felt."

Brexit, therefore, owed less to the personal charisma of Boris Johnson, the failings of David Cameron or the ambivalence of Jeremy Corbyn than to a much deeper sense of angst, alienation and resentment among more financially disadvantaged, less well-educated and older Britons who are often only one financial crisis away from disaster. They are the voters of former industrial strongholds, like the northern towns of Barnsley, Mansfield, Stoke and Doncaster, Welsh towns like Merthyr Tydfil that once fueled the industrial revolution, fading coastal towns such as Blackpool, Great Yarmouth and Castle Point, or blue-collar but aspirational places like Basildon, Havering and Thurrock.

It is certainly true that Brexit also found support in more leafy, affluent Conservative areas such as Aylesbury, Chichester, South Bucks and West Dorset where previously loyal Tories rejected Cameron’s increasingly desperate pleas to remain. By doing so they have ensured that Cameron becomes the third prime minister in post-war Britain who will principally be remembered for just one thing; after Anthony Eden and the Suez Crisis, and then Tony Blair and Iraq, future generations of students will write about Cameron as the man who took Britain out of the EU and also, given the now high probability of a second independence referendum in Scotland, caused the break-up of the entire United Kingdom. For this reason, he may be remembered as one of the most unsuccessful leaders in Britain’s modern political history.

But it remains the case that support for Brexit was unquestionably strongest in a more economically marginal and left-behind Britain.

This is why Nigel Farage and UKIP are an unpopular but important part of the story of how Brexit came to life, having cultivated this political discontent throughout the early years of the 21st century. Brexit built on UKIP's foundations. Farage and his party already averaged 39 percent of the vote across the 50 areas that would go on to give the strongest support to Brexit but only 13 percent in areas that gave the strongest support to Remain.

Farage failed to lead a UKIP charge into the House of Commons — the party has just one MP — but his decision to fuse Europe with immigration enabled him to politicize these grievances and achieve something far greater: to transform Euroskepticism from a fringe interest into a mainstream concern that would eventually deliver his lifelong ambition of Brexit.

Areas where objections are loudest are often those where the turnout was lowest.

Remainers have unsurprisingly criticized the result and demanded a re-run of the vote, though such an outcome will not be forthcoming. It is worth noting that of the 50 areas that recorded the lowest levels of turnout, no fewer than half of them were in London and Scotland, two areas that were supposed to be hotbeds of Remain fervor.

But in the end, the campaign failed to enthuse who it needed to enthuse. Prior to the result, the Remain camp talked enthusiastically about targeting large, young, diverse cities but when the dust cleared these were the places — Manchester, Nottingham, Dundee, Birmingham and Liverpool — where voters turned out in lower numbers.

Most academics, including myself, would reject the claim that higher turnout in such areas would have altered the final result but it is worth noting that areas where objections are loudest are often those where the turnout was lowest. For instance, while the London districts of Hackney and Camden are among the top five areas in terms of the number of people wanting a second referendum, these same areas were also among the bottom 10 percent for turnout, a fact that Remainers might like to reflect on.

It is difficult to see how the underlying divides that gave birth to Brexit can be resolved. If anything they may sharpen further as those who are now responsible for negotiating with the EU begin to backtrack on earlier promises about reducing immigration, which was by far the dominant concern for Brexit voters.

Should a post-Brexit government fail to respond quickly and clearly on this issue then it would be the equivalent of pouring a gasoline all over the fire of populist, anti-establishment sentiment. Britain’s left-behind have already demonstrated their willingness to punch the political elite in the face. I wouldn’t test them again.

Matthew Goodwin is professor of politics and international relations at the University of Kent and a senior fellow at Chatham House.