The TNS polling on the election in Scotland came pretty close to the result.

The SNP lead over Labour increased during the campaign, and our final poll found that - among voters who had expressed party support - 54 per cent backed the SNP and 22 per cent Labour. The outcome was 50 per cent vs 24 per cent

As the election approached, many commentators found it hard to believe that the polls were telling the truth, but all polling organisations were telling roughly similar stories.

Even armed with polling information, the numbers that told Thursday night's story were extraordinary, with record swing after record swing seeing massive Labour majorities overturned to create equally large SNP majorities.

Altogether, the SNP's 50 per cent share of the vote translated into a little over 1.4 million votes as the turnout reached 71.1 per cent - up from 63.8 per cent last time, though well short of the 84.6 per cent recorded in last September's referendum on independence. The total vote for the SNP is a Scottish record for any political party. Given the lower turnout, it compares well with the 1.6 million votes cast for Yes in the referendum.

The catastrophic result for Labour marks the end of 50 years of the party's dominance in Scotland: the party had captured the largest share of the Scottish vote in every general election since 1964. Last night also brought unwelcome records for other parties: the Conservatives' 14.9 per cent share of the vote was the worst on record, and the Liberal Democrats' 7.5 per cent was the lowest since 1970.

For five decades, Labour was able to rely on its Scottish stronghold to bolster its position at Westminster. Its high water mark came in the mid-1990s: in monthly TNS (System Three) polls between July 1994 and June 1997, its share fell below 50 per cent only six times.

Such was the apparent impregnability of Scottish Labour's position at Westminster that in 2010, when Labour across the UK lost more seats than in any previous general election, Labour won the same 41 seats it had taken at the previous general election in 2005, on a slightly higher share of the vote.

However, the formation of an SNP minority government at Holyrood in 2007 was a sign that the electoral arithmetic was changing, underlined by the SNP's stunning Holyrood victory in 2011 - it took 45 per cent of the constituency vote and 44 per cent of the list vote - up from a 20 per cent share in the 2010 general election - giving it a strong platform for the referendum campaign.

Many commentators dismissed the gap between the party's Westminster and Holyrood votes as evidence simply that Labour voters thought the SNP did well at Holyrood, but argued that they would return to their traditional loyalty in polls for Westminster

But that high level of SNP support carried over into the 45 per cent backing for Yes in the referendum. After that vote, TNS continued to take the political temperature in Scotland, and we quickly found that the referendum defeat had not dented support for the SNP. TNS polling showed a rise to level seen in Thursday's election.

As polling day approached, to deepen understanding of why some traditional supporters of other parties were switching to the SNP, we carried out focus group research.

It became clear that Labour voters liked what they saw as the SNP's positive and inclusive narrative: they saw the party expressing what many regarded as representing the older Labour values. They were disenchanted with Scottish Labour, citing poor leadership and a move to the right: it was just a "branch office" of the UK party with no clear identity or distinctive Scottish voice.

For traditional supporters of all other parties, Nicola Sturgeon was an attractive politician - strong, confident, trustworthy, accessible and plain-speaking. They liked that she was presenting a positive narrative, more representative of the forward-looking mindset of modern Scotland.

Choosing the SNP was often a largely emotive decision: voters switching from other parties were often hazy about what SNP policies actually were, and about the respective roles of Holyrood and Westminster.

Sturgeon took the independence issue off the table for the campaign, so voters with unionist sympathies could enjoy having a confident, credible, high-profile party as their voice, rather than the highly compromised Westminster parties. They were proud of Sturgeon as a representation of Scotland: unlike other political leaders, she was seen as "one of our own".

In Scotland, the election treadmill sometimes seems relentless: the vote for the next Scottish Parliament elections is just under a year away. At TNS, we are already preparing our next series of party polling leading up to that vote.

The political parties have little time to lick their wounds, work out what they have been doing wrong and set out programmes to put it right. Our focus group research shows that Labour has a major task to combat the negativity that has driven its traditional Scottish supporters to support the SNP. For all the parties, the challenge is to construct a positive narrative that voters can feel proud to support.

The decline of Scottish Labour

Date Share of vote - per cent

June 1995 (TNS poll) 57

1997 general election 45.6

2001 general election 43.3

2005 general election 39.5

2010 general election 42.0

2015 general election 24.3