To understand the external collapse of the Scottish Labour Party at the General Election, we must see it in two phases.

The first is what I describe as long-term structural influences dating as far back as the 1970s. Secondly, there are shorter-term factors that hastened the decline of Labour in Scotland to a comprehensive rout.

Many of the traditional policies of the party that has dominated the landscape of Scottish politics for so long had started to crumble from the late 1970s. These included the collapse of traditional Scottish industry in the 1980s, which led to a sharp drop in trade union membership. The unions had been pivotal in the establishment of the Labour Party in Scotland.

In addition, the Thatcher Government's remarkable success in its right-to-buy policy in the selling off of council houses undermined Labour's former public housing fiefdom. Moreover, under Jack McConnell's Scottish Executive the first-past-the post system was abandoned on Scottish council elections.

The result, paradoxically, was to end the old hegemony of the party in Scottish councils. Two other long-term influences were also relevant. First, since the foundation of the Irish Free State in 1922, Irish Catholic immigrants and their descendants tended to vote en bloc for Labour as the party most likely to deliver social justice for a disadvantaged minority.

From the 1970s, however, the rise of a Catholic meritocracy minority population achieved occupational parity with their fellow Scots by 2000. One result was that the former concern about the SNP as a Protestant party started to disappear. In due course, many within the community switched to the Nationalists and, indeed, at the independence referendum last year Catholics were more likely to vote Yes than Presbyterians.

Crucially, the Labour Party in the UK swung more to the right in order to be more attractive to future English voters. New Labour went down badly among traditional Labour voters in Scotland. Scots much preferred the policies that had founded the welfare state in the 1940s.

The Iraq war, regarded by many Scots with Labour sympathies as illegal, also damaged the party. It was clear that former Labour loyalists were declaring that they had not changed in their politics; it was the party that had done so and it left them behind.

Though these long-term factors were important they cannot explain the decline of Labour in Scottish parliamentary elections nor the rout on Thursday. At the General Election of 2010 Labour had remained by far the biggest party in Scotland. Yet, within five years, we had witnessed the destruction of Scottish Labour. A number of elements need to be considered in this context. The SNP exploited Labour's perceived failing as a party of the centre and moved in to fill the vacuum by selling the ideological clothes of "Old Labour". It did not help the Labour cause that the two SNP administrations in Holyrood were seen to have performed competently, compared with what was seen as a "semi mediocrity" of the Labour-Liberal Democrat Executive between 1999 and 2007. Of critical significance was the independence referendum campaign. Here, two influences sealed Scottish Labour's fate. First, between 2013-2014 an external festival of democracy and politicisation took place in Scotland that helped enormously to boost the Yes vote at the end of the campaign. As a consequence, many Labour supporters deserted the party in droves and they eventually made up a significant proportion of those who voted for independence.

Secondly, and perhaps most critical of all, Labour committed the ultimate betrayal in the eyes of many loyalists by standing shoulder to shoulder with the Conservatives in the No campaign. Quite simply, this was a monumental error of judgment that inflicted grievous electoral harm on Labour this week. Labour seemed to have forgotten that Conservatism remained a toxic brand in Scotland, especially among left-leaning voters. As well as committing themselves alongside the Tories, Labour agreed entirely with the stance of George Osborne not to share sterling with an independent Scotland.

In some ways, this did not simply harm Labour; it also had a serious affect on the Union because it seemed to confirm that the Unionist parties were not prepared to lift a finger to help a new Scottish state in its years of infancy, despite the fact that previous British administrations had allowed Ireland and several colonial territories to retain the link with sterling for a period after independence. Essentially, therefore, Labour committed several grave political errors. When the perfect political storm overwhelmed the UK, it was the SNP who were able to exploit the opportunities rather than Scottish Labour.

I was asked by a journalist about the possibilities for Scottish independence after the advent of the SNP minority government at Holyrood in 2007. I replied that, at that juncture, cessation from the UK was highly unlikely as less than one third of the Scottish electorate had during the previous years said they were prepared to vote for independence.

I added that, although the future was not my period, there was a possible scenario encompassing three elements that might be powerful enough to trigger a much greater commitment to a vote for independence.

First, a left-leaning nationalist majority government in Holyrood and a Tory or Tory-led administration in Westminster.

Secondly, an economic crisis that would trigger strategies of austerity from the London government which would probably attack welfare benefits, given the political complexion of the Westminster government.

Thirdly, a decline in the popularity of the only remaining party political bastion of Unionism in Scotland, namely the Labour Party.

All three have come to pass.

Professor Sir Tom Devine is Scotland's leading historian. His latest book is Independence or Union: Questions from the Scottish Past and Scottish Present (forthcoming, Penguin, 2015).