IT may not have been a 'punch-the-air' type of victory, but it was still a remarkable win.

Nine years into office, a time when most parties would be hiding under the desk at the thought of an election, the SNP polled 46.5 per cent of the constituency vote and 41.7 per cent on the list.

The constituency vote was up 1.1 percentage points on 2011, the list vote down just 2.3.

The upshot: an SNP MSP in 59 of Scotland’s 73 first-past-the-post seats, an increase of six.

In Glasgow, once the bedrock of Scottish Labour, there was a repeat of the wipe-out seen in last year’s general election, with Pollok, Maryhill and Provan all falling to the SNP.

“We haven’t beaten Labour in Glasgow, we’ve replaced them,” Nicola Sturgeon said.

It wasn’t just a Glasgow phenomenon. The SNP took every seat in six of Scotland’s seven cities.

Only Edinburgh resisted, with single LibDem, Labour and Tory wins.

The SNP also broke through the one million vote barrier in constituencies, a first for the devolution era.

But so many seats meant the SNP got only four top-up list MSPs, down 12.

The resulting total of 63 gave the SNP double the 31 MSPs of the Tories, but two short of an outright majority, and six shy of the 69 MSPs won in 2011.

After the result, the Tories were quick to claim Scotland had passed “peak Nat” and the SNP were moving into their twilight years in office.

But if just 360 people in Dumbarton and Edinburgh Central had switched to the SNP, the party would have won two more seats and achieved a second majority of 65. It was very close.

Sturgeon now has a mandate to govern as First Minister, but will need horse-trading to get her budgets and legislation through Holyrood.

The direction of the SNP campaign was set by the referendum.

The huge surge in members and funds after the No vote, and Sturgeon’s presence on the national stage during the general election, meant the party was well-prepared for the fight.

After Sturgeon appointed John Swinney her campaign director last September, he led “weekly review” meetings at the SNP’s Edinburgh HQ to develop messaging, ground operations and social media. Deputy SNP leader Stewart Hosie was tasked with preparing the manifesto.

When Holyrood dissolved in late March, the meetings became daily, starting with Swinney calling in from his home in Blairgowrie at 8.30am and often several times a day after that.

The party tracked the public mood through Activate, a computer database constantly updated with doorstep canvassing data, as well as through internal and public polls.

It was, naturally, a safety first campaign. A governing party was always going to stress continuity over change, reassuring voters rather than asking them to take a punt.

The cautious approach to tax summed it up, with income tax and council tax tweaked a little, but not much.

This, to the SNP’s private delight, enraged both Left and Right, condemned by Labour and the LibDems as too timid, and as punitive by the Conservatives.

“That puts us smack in the middle ground,” said one government source. “That’ll do us fine.”

The SNP’s instincts on tax proved far better than Labour’s. Kezia Dugdale might have pleased Labour members by vowing higher taxes all round, but most voters balked at it.

It was also a presidential campaign. Again, not surprising given Sturgeon’s massive personal approval ratings.

“It was a very deliberate strategy for us,” said Swinney. “We decided to focus very much on the strength and capability of the First Minister, her popularity with the public, and to use that as a means of engaging with the electorate.

“Every day we would also go through a policy proposition designed to show where our commitments lay and what our priorities were. We’d be setting them out to members of the public under the umbrella of ‘elect Nicola Sturgeon as your First Minster’ and ‘Both votes SNP’. I would say it was a policy-rich agenda.”

But it could be double-edged too. The SNP’s ‘Being John Malkovich’ moment, when over 1000 activists surrounded Sturgeon with manifestos bearing her own face, was widely ridiculed.

Out on the street, SNP activists also heard angry references to “that woman” from voters.

“Some people couldn’t even stand to mention her by name,” said one old hand.

Throughout the campaign, the SNP was confident it was at a steady 45 per cent in the polls.

It was enough to secure a win, but jitters remained about getting an overall majority.

Hence the Both Votes SNP message on everything from pens to billboards.

Although there was speculation the Greens and RISE might draw list votes from SNP voters, the party wasn’t worried by them specifically - any kind of split vote was seen as a threat.

“Every party has that issue,” said Swinney. “So we wanted to put as much encouragement into people using their regional vote for the SNP. I was always concerned about us getting a majority. At no stage did I believe we’d get the level of seats we got at the general election.”

As in physics, every action in politics produces some kind of equal and opposite reaction.

In the SNP’s case, its insistence on being able to hold a second independence referendum led to a Unionist backlash.

In previous elections, the Unionist vote split among the three opposition parties. But in 2016, thanks to a very focused campaign led by Ruth Davidson and Labour wobbles on the constitution, that tactical Unionist vote flooded to the Tories. The LibDem and Labour gains in Edinburgh Western and Southern were other examples.

There were other headaches too. The attitude of new members was a frequent complaint among old hands. “Yes, we’ve got a large membership, but a lot of that is inactive,” said one source.

An SNP candidate added: “There was definitely complacency with the activists. We got bodies on the streets at the weekend, but nowhere near our true strength. An awful of people clicked the button [to join]. They don’t come to meetings. A lot just sit on the net talking to each other.”

One of the factors helping the LibDems, Tories and Labour win seats in Edinburgh was a concerted drive to harvest postal votes. The SNP had almost no postal vote operation.

“Postal votes are just something we’ve never really done,” said one SNP campaigner. “We’ve always gone for a Get Out The Vote (GOTV) operation on polling day instead.”

But on polling day, Activate crashed for most of the morning, hampering the GOTV effort.

“There’s a myth that the party’s operation is really wonderful," said one senior member. "In many ways it’s actually very poor.”

And though the Both Votes SNP message was repeated ad nauseam, it yielded scant results. In six of the eight regions, the SNP got no list MSPs at all.

The SNP's new dominance of the Central Belt also had its flipside - a loss of support in the north and north east.

In its former base of Perthshire and Aberdeenshire, the SNP saw double-digit swings to the Tories.

Even Swinney had his majority in Perthshire North slashed from 10,353 to 3,336.

In part this was down to the constitutional question, in part down to a feeling that the SNP has become an increasingly urban and less concerned about rural areas.

There has also been specific anger at the government’s mishandling of European CAP payments to farmers, with IT bungles delaying money and causing real hardship.

It is little wonder that the man blamed by many for the mess, rural affairs secretary Richard Lochhead, saw his majority in Moray fall even further than Swinney’s, from 10,944 to 2,875.

However the big picture is far more positive for the SNP - thanks, ironically, to the Tories.

Davidson’s was not the only party wanting to see Labour crushed on May 5. The SNP are even more delighted at Labour’s fate.

For while opposition leader may be Davidson’s dream job, it is also a dead end one. Unless Scotland’s political outlook changes utterly, she will never progress to First Minister.

In any foreseeable electoral contest between the SNP and the Tories, the SNP always win.

A Labour opposition leader might one day be seen as a putative FM, but not a Tory one.

So the SNP’s grip on power just got tighter.

More importantly for the SNP, the decimation of Scottish Labour removes a mission-critical obstacle to achieving independence.

The Better Together campaign in 2014 was founded on Scottish Labour. The Tories cannot fill that role in the event of a second independence referendum.

Labour's destruction after it sided with the Conservatives in the No camp showed Davidson’s party remains remarkably toxic.

One SNP source said his party can’t wait for First Minister’s Questions to become a clash between the SNP’s record at Holyrood and David Cameron’s cuts at Westminster.

So the Tories may yet rue what they wished for. In pushing Labour into a ditch, they have removed one of the bulwarks protecting the Union they were elected to preserve.