A few weeks ago the economist Paul Krugman penned a column in the New York Times headlined Trump Is No Accident.

It observed the Republican establishment had spent years depicting Barack Obama as “a Kenyan Islamic atheist socialist friend of terrorists”, but now professed shock at the sight of Mr Trump turning those “dog whistles into fully audible shouting”.

Thus, far from “the Donald” representing some sort of “unpredictable intrusion” into the normal pattern of Republican politics, the GOP had actually spent decades encouraging and exploiting the political framing that now looks likely to carry Trump to the nomination. “Donald Trump is not an accident,” concluded Krugman. “His party had it coming.”

I’ve long thought a similar analysis applies to the Scottish Labour Party, which launches its Holyrood manifesto on Wednesday, and its oft-professed dismay at the rise of Scottish Nationalism. In one memorable speech before the referendum, former leader Johann Lamont even described it as a “virus”, the cynical politics of “grievance”.

But as with the Republicans and Mr Trump, Scottish Labour has only itself to blame. To explain, it’s necessary to rake over some 20th-century Scottish political history.

Scotland is essentially a nationalist country, and since the late 19th century the most successful political parties have recognised that fact and harnessed, in different ways, the electoral potency of nationalism. So the Liberals championed “Home Rule” and then the Scottish Unionists (or Conservatives) promoted the idea of “administrative devolution”, ostensibly to protect Scotland from the centralising forces of socialism.

Then along came Scottish Labour, for long culturally nationalist, steeped in Burns and the myths of Red Clydeside, but rather unsure of itself when it came to devolution. Initially, in the 1970s, it reluctantly promoted a Scottish Assembly in order to outflank the then buoyant SNP but sold it in a rather dry, technocratic way, as a means of improving Scotland’s machinery of government.

That scheme, of course, failed, and during the long years of Conservative rule in the 1980s and ‘90s Scottish Labour embraced the politics of nationalism much more ostentatiously. Margaret Thatcher, they argued, lacked a Scottish “mandate”, Conservativism was an “alien” ideology, and Westminster rule was even depicted as somehow illegitimate. Thus a devolved Parliament would “protect” Scotland from all of that, promoting “Scottish values” and “social democracy”.

Some Scottish Labour MPs were uneasy about this approach, for example Tam Dalyell (who is currently finishing off an “I told you so” book on this theme), but they were marginal voices. Labour presented itself – as the SNP now do – as “standing up for Scotland”, while a group styling itself Scottish Labour Action produced the next generation of Scottish Labour leaders, among them Jack McConnell and Wendy Alexander. Its 1988 mission statement could easily have been produced by the SNP, sans independence.

Ironically, many of those associated with this, such as the blogger Ian Smart, are now viewed by Nationalists as diehard Unionists, as is the former Scottish Labour MP George Foulkes, mentor to the current party leader Kezia Dugdale. But during the 1980s he was clearly on the nationalist wing of the Scottish Labour Party, and even enjoyed cordial relations with Alex Salmond, who dreamed of persuading Mr Foulkes et al to follow the logic of their arguments and align themselves with the centre-left SNP.

Of course this all looked perfectly sensible at the time: Labour won Westminster election after election in Scotland, dominated town halls across the country and, when the Scottish Parliament was delivered in 1999, led its first two coalition Scottish Executives. But it had also framed Scottish politics in such a way that sowed the seeds of its own electoral decline.

Indeed, Scottish Labour had already started losing votes, it’s just that the SNP was also weak, thus George Robertson’s line about devolution killing nationalism “stone dead” appeared to have come true. Gradually, however, Mr Salmond was stealing Labour’s nationalist clothes, and within a decade it was the SNP rather than Scottish Labour that was perceived to be “standing up for Scotland”.

This, since 2007, has left Scottish Labour struggling, much like the Republicans in the US, to figure out what’s going on, even more so after the 2014 referendum, which finally did what Mr Salmond had failed to do in the 1980s, aligning small “n” Labour nationalists with the big “N” SNP variety. Thus recent contortions: Ms Dugdale saying it was “not inconceivable” she’d back independence if the UK voted for Brexit, to yesterday’s declaration that under “every scenario” she’d be opposed. From pragmatic to die-hard Unionist in the space of a few interviews.

In an interview for yesterday’s Sunday Herald, Ms Dugdale also tried to discriminate between two different sorts of Scottish Nationalist, the “die-hard emotional Nationalists”, like her father, “who believe Scotland is oppressed by England”, and those “who voted Yes as an alternative to the Tories and austerity”. But the trouble is they are now largely one and the same.

And the proof of the pudding is that Scottish Labour’s born-again socialist election campaign has completely failed to halt its ongoing decline, for Scottish politics now has little do with left and right and rather more to do with Nationalism, as also evidenced by the SNP’s sudden lack of interest in talk of “social justice”, conspicuous by its absence from last week’s manifesto. It’s all about “standing up for Scotland”, and Labour have only themselves to blame.

None of this is an argument against promoting Scottish distinctiveness or the creation of a devolved Parliament, but against framing Scottish politics in such a way that was always, ultimately, going to benefit the SNP more than any other party. The Liberals, Unionists and Labour all promoted the Celtic periphery at the expenses of the Unionist core, and therefore it’s hardly surprising Scotland now stands where it does.

Writing in the New Statesman back in 1974 the Scottish Labour MP and political scientist John P Mackintosh correctly anticipated that whatever Unionists offered to stem the then SNP advance wouldn’t be enough “so long as there is no proper pride in being British”. Scottish Labour failed to promote a compelling case for the Union alongside its vision of a devolved Scotland, and the same is true of Conservatives and the European Union: decades of Eurosceptic dog-whistling has now caught up with them and produced the swivel-eyed Brexit beast.

Of course there were alternatives, either “Home Rule all round” as envisaged by Liberals a century ago or a more federal UK, which will be the subject of an Institute of Economic Affairs (IEA) conference in Edinburgh on the same day Scottish Labour launches its Holyrood manifesto in the Capital.

There is no doubt that long-awaited document will try very hard to present Scottish Labour as the true protectors of Scotland against Tory austerity, but it’s simply too little too late. Nationalism is to Ms Dugdale’s party what Donald Trump is to the Republicans, a political monster partly of its own creation.