THAT the SNP won 50% of the vote and 56 MPs is all the more remarkable when you consider the state of its campaign plan late last year - there wasn't one.

Not only was the party entirely focused on winning the referendum in 2014, its leadership calculated there wouldn't be a general election after a Yes vote.

The transition to independence would be such a priority, and such a complicated task, that Westminster would defer an election until it was done, went the theory.

Loading article content

As a result, the SNP chose not to select any candidates for Westminster.

So when the No vote arrived, the file marked GE2015 was effectively empty.

Events, however, quickly wrote the script.

First, and most spectacularly, there was a flood of new members.

The SNP had 25,000 on September 18; within a month it was 85,000.

The party also traded in Alex Salmond, always a divisive leader, for Nicola Sturgeon and what party insiders have dubbed the "Nicola phenomenon" began.

"Nicola contributed to a sense of 'wow' in the campaign," said one party strategist.

"She was able to connect with the public in a way that's almost magical."

At the same time as the SNP was acquiring a more popular figurehead, Labour underwent a leadership crisis.

After the London HQ unilaterally sacked her Scottish general secretary, Johann Lamont resigned complaining Scottish Labour was being treated as a "branch office".

Not only did it confirm what the SNP had been saying for years, it also triggered a leadership contest that left Scottish Labour rudderless for seven weeks - just when it needed to focus on the election - and which then put Jim Murphy in charge.

In contrast, the convulsions affecting the SNP were positive ones: new foot soldiers, a fortune in membership fees, and a throng of faces applying to be candidates.

Instead of focusing on the dozen or so seats where it usually had a chance, the increased numbers allowed the SNP to fight a truly national campaign.

"It meant we could go into territory we had not really explored before. We were able to carry out industrial scale canvassing," said one senior insider.

It wasn't all positive. Some of the newbies struck old hands as half-hearted.

"Many members expected someone else to do the donkey work," said a councillor.

"I knocked one door and the people said, 'Oh yes, we're SNP members' and I thought, 'Well, why the f*** aren't you out knocking doors too then?' It was exasperating."

However the sheer weight of new members - an average of more than 1300 new starts in each constituency - meant the SNP ultimately outgunned all opponents.

Candidate selections took place in the New Year, and on Valentine's Day the party's prospective MPs and their election agents gathered at the Station Hotel in Perth.

There they were drilled in strategy by campaign director Angus Robertson, in best practice by deputy leader Stewart Hosie, and in social media by Ross Colquhoun, formerly of the art house indy campaign National Collective.

Communications svengali Kevin Pringle spoke on working with/bewaring the media, while Sturgeon and SNP deputy leader Stewart Hosie discussed the manifesto.

The basic message was that May 7 would be an historic opportunity and that people were fed up with Westminster parties but thought the SNP could deliver change.

"There was one a real sense of 'We can do this'," said one of those present.

One of the word-of-mouth ideas shared between candidates was online fundraising through sites such as Indiegogo and Crowdfunder.

It would see dozens of candidates go on to raise five figure sums in small donations for local campaigns, leaving SNP HQ free to spend its cash on mailshots, adverts, billboards, events and, of course, a Sturgeon-liveried helicopter.

At the end of the day in Perth, Sturgeon chaired a political cabinet with her ministers, Robertson, Pringle and her husband, the SNP's chief executive Peter Murrell.

It decided the top priority would be promoting the SNP's anti-austerity message.

After a slow start, the party's election plan was coming into focus.

Behind the razzmatazz of every successful campaign is a solid, unglamourous grind.

Every Thursday at 5.30pm at the SNP's Edinburgh HQ, Robertson, Murrell, Pringle, Hosie and a sprinkling of ministers would meet to check on the grind's progress.

The agenda was always the same: activity, polling and canvassing data, materials and budgets, logistics and events, and the manifesto.

It was the same system as the 2007 and 2011 Holyrood elections, but those present noticed something odd was missing.

The SNP uses an "exception reporting" system, meaning it assumes things are going to plan, and focuses on fixing any problems or "exceptions" that come to light.

But this time, there were hardly any exceptions to report - the SNP machine was purring as it had never done before.

Besides old-fashioned shoe-leather and clipboard canvassing, there was also an unprecedented push online, with infographics, pictures and videos pumped out to more than 100,000 members who were urged to share them with friends.

The party promoted Twitter hashtags such as #SNPbecause, which let people share their reasons for supporting the SNP - it reached 1m in 12 hours and became the top trending UK hashtag for most of the day it was launched.

Sturgeon's eagerness to pose for selfies fed the #ImWithNicola hashtag.

Social media also helped the SNP close down unhelpful stories. Its #FrenchGate hashtag led 60,000 people to the rebuttal of the newspaper report that Sturgeon told the French Ambassador she wanted David Cameron to remain Prime Minister.

In addition to Robertson's weekly campaign conferences, Sturgeon held regular political cabinets to look at strategic issues.

But the most important meeting of all took place towards the end of February, when the SNP's focus group expert Mark Cuthbert presented his findings.

"I've never done a presentation like this before," he told Sturgeon and her inner circle, before going through slides one of those present described as being "like manna".

Cuthbert's work found a huge gulf in voter perceptions of the SNP and Labour.

Where the SNP was a strong voice for Scotland, Labour was weak and distrusted.

Nor was there one thing wrong for Labour - people had "multiple reasons" to dislike it.

For some it was the Iraq War, for others a Blairite drift to the right, or the party's sense of entitlement, the presumption that working class votes belonged to it.

To many, Labour's cosiness with the Tories in the referendum was the last straw.

Meanwhile, the SNP had earned high levels of trust because of its time in office.

Asked about the coming general election, voters saw the SNP as a credible vehicle for change - a fundamental break from its previous marginal role at Westminster.

The language used by the focus groups was that Sturgeon and the party were empowering the country, on the side of the people, unafraid, open and honest.

The focus group messages rapidly became the campaign messages.

Hence the mantra about sending "a strong group of SNP MPs" to speak for Scotland.

The meeting was not a shock - the SNP had, after all, been promoting itself in these positive terms for years - but it showed voters were now on the same wavelength.

"The most significant thing was finding out where the public was," said one participant.

"We found out what we were already doing was resonating with them. You have to remember we'd tried like the blazes in Westminster elections to be relevant, but then been squeezed by the other parties. It was something new."

And this was before the TV debates projected Sturgeon to UK-wide prominence.

After them, the media coverage, both good and bad, amplified the SNP's key message that in this election it could and would make a difference.

Suddenly a party that won a mere six seats in 2010 was held up as a kingmaker.

Even tabloid caricatures of Sturgeon which were designed to wound - "the most dangerous woman in Britain" - reinforced the idea of the SNP as serious players.

But even with so much running in its favour, there was internal scepticism about polls suggesting the party would take nearly every seat.

Thirty-something MPs was "realistic", and anything over 40 would be "phenomenal", said one senior member of the campaign team just after 10pm on Thursday.

So what was the adjective to described 56? "Supercalifragilisticexpialidocious!"

Yet success did not just fall in the SNP's lap.

The result reflected years of effort aimed at building trust in an SNP government.

It also reflected Labour's dismal post-devolution trajectory from boom to bust.

Everything clicked for the SNP on May 7, but it took a lot of graft, and luck with weak opponents, to bring the planets into just the right alignment.

Success also means challenges.

Having bragged about giving Scotland a bigger voice by influencing a Labour minority government, the SNP must try to stay relevant in the face of a hostile Tory majority.

Unless there is a new strategy, the old taunt used against Scottish Labour MPs under Margaret Thatcher - that they were a "Feeble 50" - could be updated to "Feeble 56".

Party management is also bound to be a headache.

Although the SNP hierarchy insists its candidate vetting and selection was thorough, many of its MPs are unpredictable rookies, who will be goaded by the Tory media and other parties to generate headlines. Inevitably, some will have skeletons to hide.

Right now, the road to the 2016 Holyrood election looks like a downhill coast for the SNP, but it may yet prove unexpectedly bumpy.