When Theresa May called the general election nearly two months ago, all the evidence – opinion polls and local election results especially – pointed to the expectation that the Labour Party would be crushed, with many of its MPs losing their seats.

The assumption was that Labour under Jeremy Corbyn would be unable to win over Conservative voters, because he was too left-wing to appeal to those close to the political centre ground.

Some commentators, myself included, took this a little further, arguing that Corbyn was left-wing in a way that would alienate the very people he claimed to speak for, ie working class people, while appealing primarily to virtue-signalling middle class romantics like Corbyn himself, who have no more interest than he does in the business of parliament but love a good rally or social media spat.

The local elections that took place in May appeared to confirm the above expectation and analysis, with hundreds of Labour councillors losing their seats. However, opinion polls began to shift, and while different polling companies’ methodologies led to different estimates of support for the two main parties, all showed Labour on the rise – with YouGov predicting two days before the election that the Conservatives would win a mere 305 out of 650 seats, while Labour would win 266.

Despite a miserable campaign in support of a depressing manifesto, enlivened only by the promised revival of an anachronistic bloodsport beloved of the rural elite – indeed, a campaign so bad that political historian Glen O’Hara joked about having ‘watched and wondered whether Mrs May was a Corbynite sleeper agent’ – the Conservatives actually did slightly better than this prediction, winning their highest share of the vote since 1983 and coming to hold 317 seats to the Labour Party’s 262.

This left them only 55 seats ahead of their historic rival: a gap only very slightly wider than the 48-seat lead that they had after the 2010 general election, when David Cameron defeated the supposedly very unpopular Gordon Brown. The 2017 result would have been impossible without the activists who have stuck with the Labour Party regardless of their feelings about the leader, some of whom are now publicly expressing shame at the part they played in what is widely seen as Corbyn’s triumph.

Does the Labour Party’s unexpectedly narrow defeat refute the diagnosis of Corbynism as a middle class politics that alienates the party’s traditionally working class base, but doesn’t really care? Constituency-by-constituency analysis of the 2017 results by Paula Surridge, of the University of Bristol, suggests that it does not.

The Leave vote

We should perhaps begin with a pattern that was already apparent on election night. Parts of the country that voted strongly to quit the European Union appeared to show a swing away from Labour towards the Conservative Party, while areas that voted strongly for Remain appeared to show a swing in the opposite direction.*

Surridge’s analysis confirms that this was indeed a trend: the higher the estimated Leave vote, the more the Labour vote share fell between 2010 and 2017, and the more the Conservative vote share rose during the same period. Blue dots represent actual constituencies; the red line represents the trend.

On the face of it, this is baffling. Both the Labour Party and the Conservative Party are officially committed to leaving the EU, and Jeremy Corbyn famously used a three-line whip to force his MPs to support the Tory Brexit bill in February.

The anti-Brexit parties were the Liberal Democrats, the Scottish National Party, and the Greens. There was therefore no sense in which a vote for Labour could have been a vote against leaving the EU. Why, then, should a constituency’s support or opposition to Brexit have made any difference?

This brings us to the paradox that the Labour MP John Mann has called the ‘Bolsover question’: why the second-largest Labour-to-Conservative swing in the country should have occurred in the constituency of Dennis Skinner.

Skinner is not only – as Mann observed – one of Jeremy Corbyn’s staunchest supporters in the Commons, but also – although Mann did not draw attention to this fact – one of the Labour Party’s staunchest advocates of Brexit. Why should a constituency that voted for Brexit by 29,730 votes to 12,242 have swung so heavily against a strongly pro-Brexit candidate for a pro-Brexit party?

Here’s a thought: maybe constituencies swung away from Corbyn’s Labour Party for the same sorts of reasons that they voted Leave, and swung towards it for the same sorts of reasons that they voted Remain? Or to put it another way: what if Corbynism appeals to the kinds of people to whom EU membership seems advantageous, and repels the kinds of people to whom it seems an encumbrance, regardless of the fact that Corbyn – as a disciple of Tony Benn – is resolutely anti-EU?

Let’s take a look at some of the other things that Surridge found.

Educational level

Exit polling after last year’s EU referendum found that the more educated a person was, the more likely they were to have voted Remain. While some Remainers might like to dismiss this as ignorance on the part of Leavers, it can also be interpreted as an expression of anger at being left behind in Britain’s ever-more highly globalised economy.

So we should take note of Surridge’s finding that the higher the percentage of university degree holders in a constituency, the more it would tend to swing towards Labour from 2010 to 2017, and the lower the percentage of degree holders, the more it would tend to swing towards the Conservatives.

Ethnicity

While a bare majority of white voters opted for Leave last year, large majorities of black and Asian voters chose Remain. The reasons for this are complex – but it is notable that Surridge finds that the lower the percentage of white British voters in a constituency, the more it would tend to swing towards Labour, and the higher the percentage of white British voters, the more it would tend to swing towards the Conservatives.

While it is certainly good news for Labour that it is winning votes in more diverse communities, it should think carefully about why this is not happening in less ethnically diverse parts of the country – particularly as these are often economically struggling areas unattractive to immigrants.

Class

Now the biggest question of all. The Labour Party was set up to provide parliamentary representation for working class people, and the far left trumpeted Corbyn’s leadership as a triumph for "working class politics". But opinion polls showed something very different: under Corbyn, working class support for Labour rapidly fell to its lowest point ever.

Moreover, by-election results in the strongly working class constituencies of Stoke-on-Trent Central and Copeland showed swings from Labour to the Conservatives, as indeed they had during the Labour Party’s last flirtation with Bennism in 1983. Did the general election see working class voters change their minds and flock back to Corbyn’s "socialist" party?

My goodness. Surridge’s analysis shows that the more working class voters there are in a constituency, the more it tended to swing Conservative, and the fewer there are, the more it tended to swing Labour. To put some figures on that, she found that for every 10 per cent more working class voters in a constituency, there tended to have been a fall of about 3 per cent in the Labour vote and a rise of about 5 per cent in the Tory vote between 2010 and 2017.

Think about that for a moment. This is Corbyn bringing the party back to its "working class, socialist roots"?

Correlations, 2010-2017 and 2015-2017

I sense an objection: these figures show the swing from 2010 to 2017, and Corbyn’s only been in charge since 2015. Maybe it’s all Ed Miliband’s fault?

Apparently not. Surridge calculated the correlations between all the above variables and the change in the Conservative and Labour vote, both for the period of 2010-2017, and for the period of 2015-2017. And here they are:

While it is true that many correlations are weaker for the period 2015-2017 than for 2010-2017, the positive correlations remain positive and the negative correlations remain negative.

In other words, working class voters, voters not educated to college level, and voters in ethnically homogeneous areas love Corbyn’s Labour Party even less than they loved Miliband’s. Meanwhile middle class voters, those educated to college level or higher, and voters in ethnically diverse areas love it even more.

It should also be noted that the positive correlation between the percentage of working class voters and the change in the Conservative vote, and the negative correlation between the percentage of voters with degrees and the change in the Conservative vote, are both stronger for the period 2015-2017 than they are for 2010-2017, indicating a rapid growth of support for the Conservative Party among the very social groups that Labour traditionally represented.

This should worry Labour politicians with ambitions to be in government, because there is simply no way that a Labour leader can become prime minister without persuading Conservative voters in Tory seats to switch to Labour. Corbyn may have put together an unexpectedly large anti-Tory coalition of voters, but it’s largely concentrated in areas that already vote Labour – and traditional Labour voters are being driven faster than ever into the Tories’ arms.

The triumph of the "socialism fan"

In recent decades, Labour has become the party of anti-racism. It can be proud of the fact that its vote share has risen in ethnically diverse constituencies – although it seems to me that the racism many Labour supporters (and in some cases, activists and even politicians) have shown towards the Jewish community ought to be treated with rather more alarm than it apparently is.

But whatever the positives in this mixed achievement, it should be hard indeed for the party to find cause for celebration in the fact that the Conservatives are so rapidly becoming the party of the "left behind".

In the post-New Labour era – and even more so under Corbyn than under Miliband – Labour has become a party of highly educated middle class people, "socialism fans" especially. I said it before the election, and it remains the case today.

Indeed, the Labour leadership’s understanding of this point seems the most likely explanation for their manifesto pledge to end student fees (a policy that would benefit only higher-earning graduates, since people who do not go to university do not incur student fees, and people who do but end up in lower-paying jobs don’t have to repay their loans) while maintaining the Conservative "benefit cap", which negatively affects low earners, disabled people and the unemployed.

To what extent Labour’s new middle class voters will continue to back the party in the future seems unclear. After all, Corbyn can’t really do anything about their student fees, since he is not prime minister, and while he could do something about Brexit (since Labour, the anti-Brexit parties, and pro-EU Tories such as Ken Clarke now collectively hold a majority of seats in the Commons), he’s promised not to (good Bennite that he is).

Then again, he might publicly change his lifelong position on Europe just as he has publicly changed his lifelong positions on terrorism, nuclear weapons and Nato. He wouldn’t be the first leader to decide that Paris was worth a mass.

Fair play to him, though. In losing the election by only slightly more seats than Gordon Brown, he won the anticipated leadership contest in advance. So if the working class asks for its Labour Party back, he can confidently tell it to get lost.

* Canterbury is a notable exception here, having narrowly voted Leave in 2016 but swung to Labour in 2017. A very small city with two well-known universities, it hosts a very big student population during term time (when the general election took place), a large proportion of whom would typically have been expected to be resident elsewhere during the holidays when the EU referendum took place.