THE independence movement that rocked the United Kingdom had its roots in an SNP disaster 15 years earlier.

In April 1999, Alex Salmond was toiling in the first-ever Holyrood election and his party was taking a daily beating in the print media.

In an attempt to bypass the press, the Nationalists set up their own freesheet, the ill-fated Scotland's Voice.

This direct engagement with voters was a miserable failure but it left SNP strategists with an unanswered question: how do you communicate with voters if the primary medium for doing so is hostile?

Eight years later, with Salmond again running for First Minister, the print media was more sympathetic but SNP thinkers had come up with an answer to the question. Instead of focusing solely on the press, the party would use social media to contact voters and build a team of grass-roots campaigners who were hooked up digitally.

It was a strategy that propelled the SNP into power and helped deliver its landslide victory four years later.

By 2012, at which point the details of an independence referendum were taking shape, the same strategy of crafting an alternative means of voter engagement was again being plotted. This time, the scale of the campaign would be unlike anything ever seen in Scottish politics and would culminate in the near break-up of the United Kingdom.

On one level, the official launch of the Yes campaign in May 2012 was a bit of joke. Staged at an Edinburgh cinema, the glitzy event consisted of independence-supporting celebrities and the usual politicians making rambling speeches and preaching to the converted.

More importantly, it brought together an eclectic group of individuals who would be hired to work for Yes Scotland, the official campaign group for independence.

Within weeks, former BBC journalist Blair Jenkins was the body's chief executive, surrounded by a number of well-paid directors and creative types.The cross-party Yes Scotland was never a happy ship - a management review would later clear out many of the high earners - but its communities and digital teams quietly laid the groundwork for a campaign that would send a bolt of electricity through the country.

Instead of running a top-down political campaign, the communities team put in place a basic infrastructure for local Yes groups to bring together party political members, community activists and non-political individuals who were newly radicalised.

As in the 2007 and 2011 SNP campaigns, the groups and its members would use Twitter and Facebook to circumvent newspapers and build local networks.

By November 2013 - the publication date of SNP Government's independence White Paper - the wider Yes movement had grown beyond all recognition.

Rather than consisting of activists manning jumble sales, the Yes movement was on its way to creating the 300 local community groups, 50 sectoral organisations and dozens of other spin-offs that would flood the country with pro-independence activity.

Tens of thousands of people across the country were now involved: from self-generated local Yes groups, to National Collective and the left-wing Radical Independence Campaign (RIC); from individuals manning Yes cafes, to new recruits running drop in centres.

Yes staffers knew the grass-roots campaign was working when they learned of large community debates they had not organised, run by local groups they did not know existed.

Yes Scotland was now almost redundant - it had become a "central services" resource for groups, providing literature, merchandise and email updates.

By May 30 this year, the formal starting point of the referendum campaign, Yes was the biggest grass-roots political movement Scotland had seen.

The conventional aspects of political campaigning were in place - billboards booked, a warchest in place - but Yes was making as many contacts with voters as the SNP had done in the last week of the 2011 election.

One insider said that with around three months to go, up to 30,000 contacts were being made every week, with emails reaching around 60,000 Yes activists.

On the doorsteps, Yessers jotted down each individual's enthusiasm for independence on a scale of 1-10. It was a system used to identify potential waverers who, in the course of time, would get another visit or maybe a leaflet.

The independence message on the streets and in community halls was also not restricted to the contents of the White Paper.

SNP activists clung to that document faithfully, but the Greens had their own vision, as did the leftists in RIC. Unaligned supporters would tell personal stories unconnected to party politics.

With less than four months to go, two separate campaigns had clearly emerged. The first was the "air war" between the SNP and Better Together - the latter supported by the UK Government - a fight that effectively started in October 2012 when the Edinburgh Agreement was signed.

This was a traditional political campaign of claim and counter-claim, focusing on the SNP Government's White Paper, the First Minister's controversial currency plan, and which politicians in grey suits would agree to a televised debate.

It was also a contest the seasoned political operatives in Better Together were comfortable with, as it was fought through the prism of a sceptical media.

The second campaign was the "ground war" dominated by Yes. This was one-to-one, door-to-door, intentionally bypassing the media.

This campaign was also geared towards changing the face of the electorate. Yes strategists believed the 1.9-million electorate in the 2011 Holyrood election - which delivered an SNP landslide thanks largely to middle class votes - was not an independence-friendly coalition.

In its place, Yes set about expanding the electorate by boosting registration and targeting disaffected individuals who had fallen out of the voting habit.

It was a strategy that would help produce an incredible 85% turnout on the day.

As summer approached, Better Together was winning in the air, but Yes was miles ahead on the ground. However, it would be wrong to give Yes Scotland the gold medal for this success. Senior Yes sources say the group was badly run from its inception and suffered from personality clashes and weak leadership.

An early blunder was the SNP decision, unveiled at the Yes launch, to chase one million signatures in support of independence.

Within months, Yessers became increasingly frustrated by the pointless exercise of persuading people to put their name to a long-winded pledge. It was deemed irrelevant and a waste of time.

Yes Scotland was also impeded in the early days by a central database staffers believed was not fit for purpose.

NationBuilder is a "community organising platform" designed to map political support across the country. However, the techology contained American fields such as "congressional district" and "zip code", terms that had no relevance in Scotland.

It took Yes over a year to move from NationBuilder, which was later used to retrieve historical data, to a different information-storing application.

This new programme was also unsuitable, sources say, as there was no search facility for the names of the 300,000 or so individuals whose details had been entered into its system.

A more fundamental problem was the tension in Yes Scotland between the SNP, which wanted to control the group, and the Greens, whose activists were committed to the bottom-up grass-roots model.

Although the Nationalists supported the "bypass the press" strategy, some senior SNP figures could not fully let go of Yes Scotland and viewed the referendum as a traditional election that required a command-and-control response.

As directors left Yes Scotland one-by-one, the SNP gradually usurped Yes Scotland and made the key decisions in the formal independence campaign.

By late 2013, there were two key parts of Yes: SNP headquarters, run by party chief executive Peter Murrell; and the patchwork quilt of local groups and activists that made up the grass-roots movement.

Yes Scotland, by contrast, had little power and commanded even less respect. Campaign sources, speaking on condition of anonymity, said Yes Scotland chief executive Blair Jenkins was good in front of the cameras but never a manager.

The Sunday Herald has learned of occasions when Yes staff walked out of meetings Jenkins chaired due to a perceived lack of leadership.

Staffers also began to question what the ex-journalist's role was at Yes, given that Murrell was the key decision-maker.

As directors fell like skittles, more unimpressive people joined the organisation. One "fixer" left Yes colleagues open-mouthed after asking at a meeting: "Who is Kenny MacAskill?"

Yes Scotland successfully laid the bricks for the wider movement, but the completion of the house was deemed to be in spite of, not because of, the same organisation.

As of August this year, the No campaign still had a comfortable lead in the polls. In the previous six months, Better Together had unleashed the dogs of hell on the SNP's independence prospectus. The centrepiece had been an attack on currency union - all three Unionist parties had ruled out the policy in February - bolstered by the UK Government's 'Scotland Analysis' papers.

However, aside from the First Minister's wobble in his first head-to-head debate with Alistair Darling, the omens were looking good for Yes.

With the Commonwealth Games over, the nation's gaze became fixed on the independence debate and increasing numbers of voters were backing independence.

As psephologist John Curtice made clear, Better Together's currency union argument was making little headway - Scots thought it was a bluff. As Yes narrowed the gap, the grass-roots movement was ideally placed to capitalise.

With a month to go, twice as many voter contacts were being made than in the spring. Yes activists were making between 70,000 and 100,000 contacts a week.

The narrative also began to shift, as the detailed rebuttals of the White Paper were sounding repetitive.

Better Together had, through its one-dimensional strategy, ceded the moral high ground of "change" to Yes. At the same time, the SNP and Yes moved from specific fact-based arguments to abstract reasons for voting for independence.

Complex policy promises were downgraded in favour of talk about independence being a "once in a lifetime opportunity" and "our only chance".

With the clock ticking, the Yes campaign entered its best period of the campaign. Salmond easily defeated Darling in the second televised debate and rumours began to surface of a first poll lead for Yes. At a glance, the YouGov poll in the first week of September seemed to signal an extraordinary transformation. Yes had been behind by 18 points in February but now, with days to go, the same pollster put Yes two ahead.

At this point, SNP headquarters - code for Murrell and businessman Mark Shaw - was effectively running the show.

Yes Scotland, on the other hand, was producing infographics, updating the campaign's Facebook account and producing press releases few people read. Jenkins was, in the words of one senior insider, an "absence, not a presence".

Campaign sources now believe the YouGov poll was the turning point of the referendum -and not in a good way. Not only did it wake up the markets, but the poll forced Better Together into an eleventh-hour rethink on more powers for the Parliament.

Before the YouGov snapshot, the unionist parties' proposals for beefing up Holyrood's responsibilities had been the sleeping dog of the campaign. Everyone knew Labour, the Liberal Democrats and the Tories supported greater autonomy, but divisions had prevented a timetable being lodged.

The shock poll prompted Gordon Brown -who had sullenly campaigned on his own, one step removed from Better Together - to propose unilaterally a road map for new powers.

Despite Cameron defeating Brown in 2010, the Great Clunking Fist was back in charge and his proposals were rubber-stamped.

On top of Better Together belatedly embracing "change", the No campaign also wheeled out the heavy economic artillery: supermarkets and mobile-phone operators claimed prices would go up; banks threatened to move their registered headquarters; and energy firms prophesised doom.

It was a brutal attack on what the polls said was the Yes campaign's key weakness: the economy. More voters believed they would be better off under the Union than in an independent Scotland.

In the final week, the polls either had the campaign neck and neck, or showed a narrow No lead.

As polling day neared, the Yes army prepared for one final surge. According to some estimates, nearly three million leaflets were delivered in the last few days by 35,000 activists.

As voters made their way to the booths, senior SNP sources were confident. Three senior insiders told the Sunday Herald that Yes would win at least 53%.

In the end, an incredible 85% of registered voters participated in the ballot, but Yes fell short.

Although Yes won Dundee and, impressively, Glasgow, turnout was higher in areas populated by indy sceptics. Despite the 55-45 defeat, the Yes campaign scared the world's most successful political union to the extent that President Barack Obama, the Queen and the Pope were all forced to make interventions on behalf of the Union.

One senior SNP figure said Yes had learned from the successes and weakness of their cousins in Catalonia.

The source said Catalonia had a flourishing community-led independence movement, but a weaker political organisation. The trick for Yes, he said, was in combining both.

However, not everyone in the Yes campaign can be proud of their efforts. A small minority disgraced themselves with behaviour that can only be described as bullying and harassment, such as those individuals who shouted down No speakers and yelled "slaves" at Scottish Labour MPs. Mainstream Yessers were also appalled at the BBC "bias" protests organised by the wilder elements of the Yes fringe.

However, a minority of idiots aside, a consensus exists that the Yes campaign and the referendum have been good for the country.

Martin Sime, chief executive of the Scottish Council for Voluntary Organisations, said the campaign had produced a "re-engagement with the political process".

Grahame Smith, general secretary of the STUC, said the referendum had been a "triumph for democracy" based on a "thirst for information and engagement".

Yes lost last week, but the movement it spawned has changed politics in the UK forever.