The Scottish National Party’s triumph in the European elections was expected, and then it happened. This in itself is surprising enough, given the near-total breakdown of all other things into sheer, unremitting contingency. English commentators — when they notice — drool over Scotland’s solid, predictable return of yellow-rosetted representatives to any parliament that requires them. Scottish commentators, depending on their constitution, cast jealous or terrified glances south at the torrent of change engulfing their Sassenach colleagues.

The SNP’s early successes in 2007 and 2011 were not so much about independence as the party’s expert performance of “competence”, an act — carefully choreographed, even if things wobbled behind the scenes — that has continued to charm voters as chaos reigns elsewhere.

Such a performance would have been impossible without a disciplined party machine honed through decades of grim competition under Britain’s first-past-the-post electoral system, where any split in the nationalist ranks threatened electoral death. Nigel Farage has also begun to work this out, but his solution is a blunt instrument: a private company, not a party, run as a dictatorship rather than a democracy. This attempt to hack British democracy is of course deeply sinister and it seems lazy, too, in the face of the SNP’s achievement: a living political organism, whose members and messaging appear to grow from and circulate naturally amongst the wider public. Since 2007, the SNP leadership have built this mass party through six consecutive election triumphs in Scottish, British and European parliaments, repeatedly plunging their opponents into chaos and panicked infighting.

But in the story of their extraordinary, sustained assault on decades-old truisms of Scottish political life, the hiccup of the independence referendum is sometimes a little too easily ignored. It was, in some ways, a considerable success for the party, who used it to consolidate their (now largely forgotten) absorption of the Scottish Socialist Party’s support, begin their conquest of the Scottish Labour Party’s core vote, and swing the Scottish Greens round to full-bodied support for independence.

The subordination of the previously diverse and fiercely independent Scottish left to the SNP’s primary objective is surely the party’s greatest political triumph since coming to power in 2007. It set the stage for their impressive electoral durability, sweeping all but three Scottish constituencies in the 2015 general election and surviving tougher challenges in 2016 and 2017 as the Conservatives and Labour fought over the spoils of a Unionist and largely right-wing backlash.

Yet the SNP doesn’t merely exist for power; every one of its approximately 120,000 members swears fealty to independence and the Scottish national interest when they join, and on both counts they must look back on 2014 as a tragic failure. Promised safety within the EU should they stay in the UK, Scottish voters are about to be yanked out of the other union despite voting overwhelmingly to remain. The Unionist surge that followed 2014 thrust enough Scottish Conservative MPs into office to hold the balance of power at Westminster. Had they been SNP, Liberal Democrat or Labour instead, they could have ensured the end of Conservative rule. And would England have been as confident in plunging out of Europe had it already endured the wrenching loss of one union?

Brexit and another Tory government haven’t only damaged Scotland’s prospects within the UK; they are also, somewhat paradoxically, potentially lethal to the cause of independence. Economically and politically, independence — in Europe, at least — becomes an even harder sell should the UK opt for a no-deal Brexit. The hard border with England that “Project Fear” suggested would result from an independent Scotland failing to achieve swift European accession could become a reality. It is by no means guaranteed that Scotland’s Anglophile middle classes and small businesses will necessarily opt for the new union over the old when it comes to it. The prospect of being a member of neither is barely worth considering.

The bigger question is: will it ever come to it? Nicola Sturgeon’s recent announcement of legislation establishing the rules for any future referendum is a classic bit of political can-kicking, typical of the SNP’s tendency to use the symbolic heft of official procedure to tease the prospect of independence without making any clear steps towards it. The final say on a second vote lies with Westminster, where — despite Holyrood’s pro-independence majority — the Conservatives and DUP have no desire to permit one.

The dirty little secret of devolution — that it was built and still stands on the basis of Westminster’s permission — haunts a devolved mentality whose mythic architecture of “popular sovereignty” reveals a remarkable naivety about how the British state actually functions. Short of armed insurrection, a general strike or unprecedented international pressure, there is no way for Scotland to force the hand of a governing party whose Scottish voters are also militantly opposed to another referendum.

This is where things become very difficult indeed. Devolution, frustrated in one referendum in 1979, had to wait until another Labour government to be realised. Another independence vote is thus likely to rely on Jeremy Corbyn’s agreement, perhaps in a minority government propped up by the SNP (as was the case in 1979). Scottish Labour’s left-wing leadership, currently locked in a battle for survival after the party won just 9 per cent of the vote in the European elections, is desperate to win round left-leaning SNP voters, and knows that to refuse a second independence referendum would be wildly counterproductive. But should a Labour government enter power, one of the central planks of the case for independence — escaping endless rule by English Tories — will be dangerously fractured, particularly if Corbyn and John McDonnell fulfil their plans for the redistribution of economic and political power across the UK’s nations and regions.

Sturgeon says she wants a referendum in the second half of 2020. This may simply be her latest attempt to keep supporters happy and delay the inevitable admission of failure. The European election result provided some respite from a rebellion brewing in party ranks, threatening internal conflict on a scale unseen since “fundamentalists” were purged during John Swinney’s unhappy time as leader in the early years of devolution. Joanna Cherry, the MP for Edinburgh South West who nearly beat Ian Blackford to leadership of the Westminster group in 2017, has come to represent a revived fundamentalist wing among the party faithful, tired of triangulation and discipline in the absence of a new referendum. She has become a symbol of wider pressure on the leadership on a range of issues from its treatment of MPs under police investigation, its plans to retain the pound sterling after independence, and its support for gender self-identification through the Gender Recognition Act.

This has fed into a swirl of rumours around the impending trial of former leader Alex Salmond — who remains popular amongst the party grassroots — for multiple charges including attempted rape and sexual assault. The trial is expected to be a profoundly difficult spectacle for the party, and Sturgeon’s future as leader has been questioned by leading journalists and MSPs.

With internal divisions enduring and no obvious heir to the party throne, the prospect of a referendum in 2020 is difficult enough to imagine; but even more troubling is what happens in 2021 if the pro-independence majority in Holyrood is lost. Then, the movement might break out into open warfare, perhaps faced with its own populist moment if some canny operator can tie together conservative impulses over gender identity, fundamentalist nationalism and broader left-wing discontent with the party’s triangulation to middle-class voters.

On the surface, then, Sturgeon is riding high after another emphatic electoral success, and continues to contain the contradictions of devolved nationalism with characteristic skill. But the party’s hegemony is a precarious one. It shouldn’t be forgotten that despite the image of cautious, competent, liberal consistency, the SNP were among the first to upend expectations in the aftermath of the 2008 financial crisis. Nobody should rule out another surprise from this most extraordinary of political phenomena.

But the SNP’s hopes may now rest on another, more profound set of upsets: the drastic softening, or indeed halting, of Brexit, and the arrival in office of prime minister Jeremy Corbyn. They must also hope that for Scottish voters, these won’t be good enough reasons to stay in the UK after all.