IN retrospect, it’s perhaps surprising the Remain side didn’t suffer a bigger defeat last week.

Theirs was a campaign out of step with electors and our sceptical populist times.

Despite the anti-politics sentiment sweeping the globe, it was a thoroughly establishment affair, over-reliant on lofty expert opinions and arid financial institutions.

Warnings from the Treasury, IMF, and Institute of Fiscal Studies about the impact of leaving the EU on the economy carried little weight with those who already felt excluded from it.

Like all referendums, it also changed shape as it went along, drifting from its original focus on EU reforms and becoming a chance to lash out at a remote political elite.

Now the blame game has started, much of the fault is being laid at David Cameron’s door - and the Prime Minister does deserve the opprobrium of angry Remainers.

He called the referendum not because of public demand, but to placate the Eurosceptic right of his own party and MPs worried about Ukip targeting their seats.

Cameron also promised the impossible on immigration, declaring in 2010 he would reduce the annual net figure below 100,000 - “no ifs, no buts”. By 2015 it was 333,000.

The free movement of people within the EU had made it a lost cause from the start, yet he persisted with the pretence.

And it was Cameron who negotiated the package of reforms earlier this year which was meant to convince voters Europe was responsive to UK concerns, but is now forgotten, or at best remembered as a damp squib.

His comeuppance is a political headstone bearing a damning one-word judgment, ‘Brexit’.

But it was not just Cameron’s fault.

It was also a failure by generations of UK politicians to speak up for Europe instead of using it as a handy scapegoat, and to prepare and inform the country for rising immigration.

While Eurosceptic MPs, a right-wing press and Ukip had been demonising the EU for years, and urging curbs on migration, the political establishment failed to champion Europe and was too quick to dismiss working class concerns about jobs and services as xenophobia.

Gordon Brown’s infamous description of Gillian Duffy, a Labour supporter who challenged him about the economy and immigration in 2010, as “just a bigoted woman” summed it up.

So when, after his surprise general election win, Cameron was forced to call the referendum, Remain was on the backfoot. It didn't seem to realise it.

Fresh from success in the Scottish independence referendum, Cameron and George Osborne blithely re-ran the divisive Project Fear tactics of 2014.

True, Project Fear ultimately helped deliver a Unionist win, but it also fuelled voter resentment and saw support for Yes grow 50 per cent during the campaign.

Project Fear had also been balanced in the Scottish context by an emotional factor - the attachment of No voters to the United Kingdom and what they saw as a shared national identity and history.

But the EU campaign lacked this essential emotional component.

Voters had no warm feelings toward the EU, its politicians or institutions.

If they felt anything, it was suspicion, antagonism or disgust at a bloated bureaucracy.

So when Remain tried to graft Project Fear onto the EU debate, it didn’t take.

It came across as all fear and no heart.

One commentator memorably called it the ‘tin man’ referendum.

Meanwhile Leave acquired its version of the endearing but goofy scarecrow from the Wizard of Oz, complete with straw haircut.

After months of playing hard to get, Boris Johnson, Cameron’s rival through Eton and Oxford and challenger for his Downing Street job, signed on in late February.

“Boris coming in was very significant,” said one strategist for the Remain campaign, officially called Britain Stronger in Europe.

“When that happened I thought, ‘This is on. They could win.’

“They needed a showman and Boris was it. His arrival made it a proper contest.”

But it was not a traditional contest. Facts, which Remain had been banking on, didn't seem to matter with emotions running so high.

Leave also revelled in a shameless slipperiness that Remain never got on top of.

Its central claim that the UK sent £350m a week to Brussels was a gross figure, and the net figure, after rebates, was a third of that.

But Leave put it on its bus regardless because it got people talking.

Unlike the SNP in 2014, who published a vast White Paper on independence, Leave also offered no prospectus for Brexit, knowing opponents would only take aim at it.

One Remain campaigner said: “Leave knew that on the Friday after the vote, it would no longer exist. So it just said what it wanted, regardless of the facts. It started by blowing a dog whistle on immigration, and ended up using a bullhorn.”

Remain also lacked a snappy message as to why people should stay in the EU while Leave had the ‘gut’ issue of immigration and its Take Back Control slogan.

“Leave’s big argument was on immigration,” said one Remainer. “But if you asked 10 people why they’re voting Remain they would have 10 different answers.

“That’s why Remain focused on the economy in a carbon copy of the Indyref campaign, because that’s what motivates a lot of people.”

But Cameron and Osborne’s approach was to roll out implausible long-range Treasury forecasts, such as households being £4300 a year worse off after 15 years of Brexit.

Frustrated, Nicola Sturgeon attacked the “overblown claims” in May.

“We only have to look at the Scottish referendum to know that kind of fear-based campaigning, that starts to insult people’s intelligence, can have a negative effect.”

But as the polls tightened, the Chancellor became even more strident, warning of an emergency budget and £30bn in cuts and tax hikes after Brexit.

The claim was such nonsense - Brexit would be at least two years after the vote - it infuriated many on his own side, and was immediately dubbed a “punishment budget”.

The contrast with the Remain campaign in Scotland is instructive.

The dynamic in Scotland was already different because of lower levels of immigration, the virtual absence of Ukip, and the overlapping Holyrood election campaign.

But the local Remain campaign, run by respected former SNP spindoctor Kevin Pringle and Labour strategist Frank Roy, consciously avoided the Indyref playbook as it was so polarising.

Instead, they offered a non-party positive vision of a united Scotland, with which as many people as possible could identify.

The Scottish parties meanwhile focused on the issues closest to their core support.

The LibDems - described by one senior Remainer as “so pro-European it’s f***ing unreal” - played up international cooperation.

The Conservatives dwelled on the economic risks, Labour the threat to workers’ rights, and the SNP, after a muted start, finally pressed home the message that a Remain vote in Scotland could lead to a second independence referendum if the overall vote was Brexit.

But even with all the Holyrood parties behind Remain, the polls, just as they had south of the border, began to shift in Leave’s favour in the closing weeks. The First Minister’s inner circle became jumpy.

“The numbers are not where we expected them to be,” admitted one of her allies at the time. “There’s no emotional attachment to the EU. It’s definitely squeaky bum time.”

The final TV debates highlighted the Leave’s sides problems.

In the first, on ITV, Sturgeon appeared alongside Tory energy secretary Amber Rudd and Labour’s Angela Eagle. All had their moments - and Sturgeon in particular gave Boris Johnson a drubbing. But Remain’s arguments still appeared scattergun and scrappy, and lacked a simple overarching message.

In contrast, Boris Johnson, Labour MP Gisela Stuart and Tory Andrea Leadsom showed impressive message discipline, hammering home the “Take back control” mantra.

Twelve days later, the BBC’s Wembley debate saw London mayor Sadiq Khan, TUC general secretary Frances O’Grady and Scots Tory leader Ruth Davidson, finally deliver a united Remain narrative - the other lot are clueless racist liars.

Khan accused Brexiters of peddling “Project Hate” and Davidson denounced Johnson for not having a plan for Brexit.

But it was too late. On polling day, it was 52-48 for Leave, with older, poorer and less educated electors the most pro-Brexit.

The widely forecast revenge of the proletariat, bashing the political elite, had come true - the housing schemes of middle England had risen up.

As in the Indyref, huge numbers of Labour supporters ignored their party and voted for something they felt could deliver the dramatic change that politics-as-usual had not.

“Corbyn's lacklustre support - particularly in the middle of the campaign when postal votes were cast - was a significant factor,” said a furious Labour Remain worker.

“He's got what he's supported all his political career - the UK out of the EU. It won't mean anything to his comfortable life, but it'll hurt thousands of working people across the UK.”

So what next? The LibDems have the fewest problems. They remain solidly pro-European, and a poll by Lord Ashcroft on Friday showed their supporters voted 75 per cent to Remain.

Labour are in bigger trouble, with Corbyn facing a confidence vote by his MPs in days.

However, the Ashcroft poll suggested 63 per cent of Labour voters, despite his grudging support on Europe, still backed Remain.

Far more divided are the Conservatives. The Ashcroft poll found an extraordinary 58 per cent voted against Cameron’s position - in other words, against their own party leader, against the first Tory Prime Minister to win a Commons majority in 23 years.

That is as acutely dysfunctional as Labour’s decline is chronic.

After barnstorming Wembley, Davidson was briefly touted as a potential UK Tory leader.

The Leave vote scuppered that - she was on the wrong side of the argument and too hostile toward Johnson, the presumptive next PM.

Her job now is to deliver her election promise to thwart a Yes vote in a second independence referendum.

The First Minister’s task is to deliver that vote. But it will not be easy. It is too simple to read Scotland’s 62-38 support for Remain as a majority for independence too.

Indeed, the Ashcroft poll found 36 per cent of SNP supporters backed Leave, almost the same degree of division as among Labour supporters.

Many of the disaffected working class who backed Yes in 2014 are likely to have voted Leave on Thursday. Will they support independence again if it means staying in the EU?

Sturgeon has left herself wriggle room, saying Brexit against Scotland’s wishes makes a second independence referendum “highly likely”, rather than inevitable.

She will be loath to go to the country unless polls show strong support for Yes, and the economic case for independence remains an obstacle, especially after the oil price crash.

But after long identifying a cross-border divide over Brexit as a trigger for Indyref2, and with demand snowballing in the SNP for a fresh ballot, it is hard to see any other outcome.

Nicola Sturgeon’s moment of truth is fast approaching.