It took a while – much too long for some of their political opponents – but last week the SNP finally experienced Newton’s law of gravity: what goes up must come down.

And given the Nationalist peak of 56 MPs and nearly 50 per cent of the vote in 2015, there was a long way to fall. The result – 35 MPs and 37 per cent – actually masked something more troubling; to paraphrase Michael Foot on SNP gains in 1974, it’s not so much the 21 losses that’ll be worrying the SNP, but the half dozen near misses.

For that reason alone, the SNP will be hoping talk of a second UK general election comes to nothing, but even if it does not, the party faces four significant challenges between now and the 2021 Holyrood elections.

The first, independence, hardly needs reiterating. When a party’s core aim, it’s very reason to be, becomes a vote loser, as Sturgeon, Swinney and Russell have all conceded, then there’s obviously a problem. The circle the First Minister now has to square is finding a way of parking the idea of a second referendum convincingly enough to drain the fuel of the Scottish Tory revival, while also keeping the dream alive for the SNP’s impatient wing.

That is almost impossible. Remove it completely from the table (rendering Ruth Davidson a victim of her own success) and those who believe in “independence, nothing less” will be on the warpath, and if a second ballot remains in place – with whatever caveats – the Tories and, to a lesser extent, the other Unionist parties, will claim Ms Sturgeon remains “obsessed” with freedom at any cost.

There are also narrative challenges. Think of the main Nationalist tropes of the last few years (if not decades) and most are now considerably weakened. Scotland doesn’t vote Tory, we’ve been told ad nauseam; this was always overstated, but now even more so. When only 220,000 votes separate the “party of Scotland” from the apparently anti-Scottish Conservatives, that’s clearly a difficult line to maintain.

The same is true of the SNP’s long-standing attempt to depict Scottish Labour as either Blairite or, when that didn’t work, hopeless. Although the party’s share of the vote didn’t actually increase by that much at this election, with seven MPs and 27 per cent of the vote, the “Red Tories” are clearly back in the game. Indeed, Scotland is now a healthy three-party state, the SNP, Tories and Labour on 37, 29 and 27 per cent of vote respectively.

Brexit is the second challenge. In traditionally Tory parts of Scotland, particularly the rural north-east and south, where support for leaving the European Union was strongest, there was a clear swing from the SNP to Conservative. The key demographic in this respect were “Yes-Leavers”, those who want to “take back control” from both London and Brussels. Many appear to have voted Tory.

Take Moray. In a constituency where there were clearly more supporters of Brexit than the SNP, it made little sense for the ousted deputy leader Angus Robertson to fight a pro-European campaign, but that’s what he did. In fishing and agricultural constituencies this was even more clearly the case, and with the First Minister’s EU fudge – “interim” membership of EFTA and the EEA – only reluctantly and sparingly articulated, it proved impossible to hold on this group.

Even beyond the election, Brexit poses challenges. Not only has Scottish Tory leader Ruth Davidson made an audacious pitch to steal the First Minister’s clothes as Scotland’s “voice” in the imminent negotiations, but if she and other Tory rebels are successful in persuading an embattled UK Government to pursue a softer Brexit with continued membership of the single market, then the whole rationale for a “differentiated” Scottish deal, and indeed a second referendum, are gone.

The third challenge comes in the unlikely guise of UK Labour leader Jeremy Corbyn. Despite last-minute efforts to contain a Labour surge (Sturgeon revealing that phone call with Kezia Dugdale now makes a lot more sense), the SNP underestimated Jezza and his utopian appeal. Another key narrative, that independence was a utilitarian means to a social democratic end, crumbled under a better-than-anticipated Labour campaign.

Embarrassingly for the Nationalists, many of the left-wing supporters they won over in 2014 and 2015 opted to back UK-wide progressive politics instead of the Scotland-only variety. When Corbyn crashed and burned (as it was believed he would), the SNP could have credibly argued that Labour couldn’t “save” Scotland from the wicked Tories. But now a left-wing Labour government looks eminently achievable, independence looks not only less attractive but less attainable.

There’s an independence-like dilemma in how the SNP responds to this. If it tacks left in response to the obvious appeal of Corbynism, then winning back voters in the rural south and north-east will be that much harder, and if it triangulates rightward (as an under-appreciated sort of Nationalist desires), then the “social justice” rationale is undermined. Either way, the “big tent” approach of Alex Salmond appears to have died along with his political career.

The final challenge is the Scottish Government’s domestic record. Even though this was a UK election, SNP ministers found their mediocre record on health and education scrutinised as never before. No longer can they pitch themselves as a “competent” administration, the key to victory in the 2011 Holyrood election, and unless education has been turned around by 2021 (which, to be frank, seems unlikely), then what precisely will Ms Sturgeon have to offer voters as she seeks re-election?

If all of the above seems a bleak prospect, that’s because it is, although it isn’t unsalvageable. The First Minister, unlike Mrs May, at least has time and scope to bounce back. Everything hinges upon Brexit. If, as seems likely, this proves difficult and economically damaging with the UK humiliated as a result of a weaker hand, then further down the line, most likely after the 2021 election, Ms Sturgeon could credibly revive her referendum plans.

But that’s a big if. In a column a few months ago, I wrote about the SNP’s loss of momentum, now confirmed in two elections in as many months. The trouble they have is that once momentum is lost, it’s fiendishly difficult to regain. Whatever “reset” the First Minister unveils in the coming days or weeks, it’ll have to be pretty darn good.