At my kitchen window, I stand and look down over Edinburgh North and Leith. It’s a jumble of handsome, expensive, sandstone tenements, new executive developments, a fashionable waterfront, and – down Leith Walk – narrower streets that still retain some of their old sense of working-class community. But these days, they are also full of students of all nations, of recent arrivals from southern Europe or Sudan and of young, cash-strapped creatives.

Perhaps not surprisingly, 78% of the people of this area voted on Thursday to remain in the European Union; they were part of a huge 74.4% majority in Edinburgh as a whole, and a 62% majority across Scotland, which included a clear Remain vote in every single local authority area. Yet on Friday morning, the people of Scotland woke to find that they were to leave the EU because of a furious act of rebellion, in large part by English working-class voters who have been ignored, silenced, scapegoated and neglected for too long and have now lashed out in an ill-directed but passionate act of defiance.

It’s not that Scotland does not understand the anger against the mainstream UK political parties that caused Thursday’s political earthquake. When Nicola Sturgeon made her first post-Brexit statement at Bute House, she stood there as first minister because Alex Salmond’s masterly positioning of the SNP as Scotland’s new party of social democracy made them the massive beneficiaries of Scotland’s own rebellion against the parties of establishment neoliberalism, first the Tories, then New Labour. It was Scotland’s good fortune to be offered an alternative that leaned to the centre-left and was – and remains – explicitly anti-racist and pro-immigration. And increasingly Scottish working-class voters have seized that alternative with both hands.

All of which places Nicola Sturgeon in an enviably strong position, as she surveys the post-Brexit political landscape; indeed, the SNP currently looks like the most credible political force anywhere in the UK, as the leaderless Tories continue the internecine battle that led to the present crisis and Labour remains hopelessly divided over its response to the new rightwing populism unleashed in England and Wales.

And on Friday morning, the first minister radiated statesmanship and calm as she pointed out, using the words of the SNP’s manifesto for last month’s Scottish parliament election, that the British exit from the EU did represent a “significant and material change” in Scotland’s political circumstances, which might justify a second independence referendum. The social media in Scotland have been full of the sound of former unionist celebrities – from JK Rowling to the veteran pro-European novelist Allan Massie – declaring that they might well now vote Yes to Scottish independence. Yet Nicola Sturgeon was strikingly careful to make no promises, as she announced legislation to open up the possibility of a second referendum. In the coming period of upheaval for the whole UK, Scottish opinion may well be subject to sharp mood-swings, from initial fury at being dragged out of the EU against our will, to mounting apprehension at the thought of having to undergo a triple process of change – Brexit, independence, then reapplication for EU membership – to restore a status quo that may in any case be collapsing, as rightwing nationalist parties across Europe start to agitate for exit referendums.

Nicola Sturgeon is committed to exploring every way of avoiding that traumatic process for Scotland, including the possibility of an arrangement such as the one applied to Denmark and Greenland, which allows one autonomous region of a member country to remain in the EU, while another departs. And she will be acutely aware that the SNP’s chances of winning a second referendum will finally depend on the performance of the UK government at the time, and on whether Scottish voters view its style and direction as something they can tolerate or something worthy only of rejection.

If any group in English politics is still interested in preserving the union with Scotland, they would therefore be well advised to arrange a sharp exit from the Westminster front line for that unlovely collection of opportunistic toffs, reactionary clubmen and stockbroker-belt quasi-fascists who, on Thursday, managed to bamboozle a majority of English and Welsh voters into mistaking them for friends of the people.

For in the end, the terms of Britain’s post-imperial settlement dictate that only a decent, progressive and broadly social-democratic government at Westminster can hold this multi-national state of ours together. And it’s because we have been without such a government for far too long that England’s rage exploded with such devastating force and that Scotland now faces another series of momentous decisions on whether we can build a viable future within the British state, or must chart our own course, out from the old port of Leith, and back towards the heart of the troubled Europe that has come to seem like home.

Joyce McMillan is a columnist for the Scotsman