David Cameron's EU referendum, intended to unite his party, has split the country. Governments can navigate the shambles only if they focus on jobs, incomes and public services, not political interests. But while Theresa May struggles with her ultras, Nicola Sturgeon sets tests the UK must meet to avoid another referendum.

READ MORE: Nicola Sturgeon raises fears of consequences of 'hard Brexit'

Both must understand that the vote was more a cry of distress than a political statement. Half the people in Britain - 40% of Scots - think the system doesn’t work for them. England isn’t so different from Scotland. People are hurting there, just like here. But they blame Brussels, not London.

Theresa May can't ignore the vote, but doesn’t have to believe the impossible things Leavers believed. Instead she must focus only on Britain’s national interest – negotiating the best for the economy, and keeping our political system stable. They go together.

READ MORE: Nicola Sturgeon raises fears of consequences of 'hard Brexit'

The economy benefits from open borders. Scottish companies can trade across both the British domestic market and the European single market. That’s one reason more people are working in Scotland than ever before. Mrs May’s top economic priority must be single market access, and Ms Sturgeon is right to press for that.

The obvious solution is something like Norway’s - joining the European Economic Area. It comes at a price we should not refuse to pay: free movement of workers. Without free movement the Border is back in Irish politics, with unpredictable consequences. And while I don't believe in separating Scotland from the UK, if we did, the last thing we’d need is a new Hadrian's Wall along the Cheviot Hills.

READ MORE: Nicola Sturgeon raises fears of consequences of 'hard Brexit'

These matter most, but it’s right to look to keep other EU advantages Scotland presently enjoys. But Ms Sturgeon cannot just ignore the advantages Scotland gets from the UK too. Public spending we could never afford on our own; a currency union, perhaps a million jobs that depend on the British market. Sacrificing those for only tenuous European connections would be cutting off our nose to spite our face.

There’s one glaring lesson from the shambles. A referendum on a half-baked plan, which can’t be delivered afterwards, was a big mistake. The test for another Scottish referendum is not what Mrs May now negotiates. It’s not to repeat the UK’s mistake. The SNP would need to present a plan that can deliver with certainty on things like EU membership, currency, and public spending. Maybe that’s what’s holding Ms Sturgeon back.

* Professor Jim Gallagher is a fellow of Nuffield College Oxford and a former adviser to Better Together