IT has been a difficult couple of weeks for the Scottish Government. The Finance Secretary, Derek Mackay, was forced into an awkward U-turn over council funding in last week’s budget; there has been outrage over the mismanagement of Scotrail; Scottish education slipped in the international PISA performance tables; councils are up in arms about service cuts; and the press have been accusing Nicola Sturgeon of making Scotland the highest-taxed region of the UK. Christmas hasn't come early for the First Minister.

Yet the remarkable thing after this tumultuous year, which many forecast would mark the beginning of the end for the SNP, is that the party remains the dominant force in Scottish politics – by a mile. Its standing in the headline Westminster and Holyrood polls has rarely dipped below 50 per cent. This has been confirmed on the ground in a string of local by-election victories most recently in the former Labour heartlands of Fife.

By any standards this is extraordinary. In a few months, the SNP will be celebrating 10 years in office. For a governing party to be this popular for this long is almost unique in UK political history. Even successful administrations generally suffer bouts of unpopularity in mid term and there are compelling reasons for this.

Governing is tough and the press is unforgiving. Over the years problems mount, often to do with the NHS, election promises are abandoned in the face of political reality, party leaders contradict themselves, members of the governing party get involved in scandals and people tire of hearing the same old lines from the same old faces. Eventually, voters forget how much they disliked the opposition when they were in office.

The SNP faced a catalogue of problems in 2016 including a crisis over GP recruitment. Promises on council tax reform, student debt, private finance, and a higher rate tax have all been abandoned. SNP MPs have been getting involved in financial scandals with alarming regularity. Nicola Sturgeon's threats to hold an early independence referendum have begun to sound hollow as support for independence has failed to grow following Brexit.

OK, critics say: the SNP is still popular in Scotland, what's new? Didn't Nicola Sturgeon lose her majority in those 2016 Scottish elections? Hasn't she overstretched herself by insisting on Scotland getting a special arrangement with the EU which has no sign of materialising? I keep being told on social media that “the Nats have been rumbled on education and the NHS” and it's only a matter of time before they lose popularity.

London commentators like the New Statesman's Nick Cohen portray the SNP as a kind of far-right populist party – ethnic nationalists using leftwing rhetoric to fool voters. But none of this seems to have damaged the SNP's image amongst the many former Labour voters in Scotland. In the 2016 Holyrood elections, the SNP still won more seats than the three main unionist parties, Labour, LibDem and Conservative, combined.

The SNP undoubtedly compromised its leftwing credentials among the wider Yes movement by deciding not to reintroduce the 50p tax band on high earners. It has been very small-c conservative in its management of the economy. After 10 years it is hard to see any significant changes to the inequalities that disfigure Scottish society. The memory of the introduction of free bus passes, free prescriptions and free tuition is fading. On civil liberties the SNP ignited furious controversy over its Named Person scheme and the Offensive Behaviour at Football (etc) Act.

These issues have been well publicised by a mostly hostile press, but none of it seems to have benefited the SNP's traditional rivals in Scotland: Labour and the Liberal Democrats. In 2016, Labour became the third party in Holyrood and the LibDems slipped behind the Greens. It's hard to believe that these two parties, in coalition, were governing Scotland as recently as 2007. Nicola Sturgeon's main challenger now at First Minister’s Questions is a Tory: Ruth Davidson.

The big political story of 2016 has been the rise from oblivion on the Scottish Conservative Party. Ruth Davidson has done a remarkable job and in some opinion polls is more popular even than the First Minister. Assisted by her celebrity in the UK media – she is becoming a chat show regular – Davidson has arguably become the leading unionist voice in Scottish politics.

This presents a challenge to Nicola Sturgeon, but it is in some ways the kind of opposition the SNP prefers. They don't believe that the Conservatives, even with their dynamic leader, could ever become a serious contender for government in Scotland. And the rhetoric of the Conservatives has in some ways helped the SNP in its main task of marginalising Labour.

Take the Tory attack last week on tax. The press headlines echoed Ruth Davidson's claim that the SNP is damaging the economy by making Scots “the highest taxed families in the UK”. Middle-income Scots have, she says, lost £300 because the SNP’s failure to uprate, along with England, the threshold for higher-rate tax. Councils are to be allowed to increase council tax by 3 per cent. The Conservatives claim that this has damaged the economy by making Scotland less attractive to investors.

However, being attacked for these tax “increases” has bolstered the SNP's rather threadbare claim to be a party of the left. It negated Labour's main attack line, which is that the SNP have not used the new tax powers to raise income taxes on the better off. The “middle-earning” Scots who are paying more tax than their English counterparts may not think of themselves as wealthy, but they are in the top 15 per cent of earners in Scotland. The much criticised council tax freeze has finally been lifted in 2016.

Similarly, the calls to renationalise rail in Scotland, opposed in principle by the Conservatives, has arguably benefitted the SNP, even though they're only talking about a public sector bid to take over Scotrail, not outright nationalisation. And of course Brexit, which is supported by Davidson, has pitted the largest opposition party in Holyrood against the majority of Scots voters.

The prospect of Scotland being forced out of the European Union overshadows all political issues right now. Brexit could make or break the SNP as it prepares, this week, to unveil is proposals for keeping Scotland in the single market. It is hard to believe that Nicola Sturgeon can come up with any kind of formula that will not be roundly rejected by the UK Government, who will of course be doing the negotiating with the EU after Article 50. Whether this helps or hinders the SNP's onward march in Scotland remains, as they say on the BBC, to be seen.

But there is no reason to suppose that the SNP's grip on Scottish politics is going to end any time soon. Independence remains the defining issue in Scottish politics. After the independence referendum campaign in 2014, the SNP was the first to capitalise on the recent rise of insurgent, anti-establishment politics. Ironically, it is now the establishment in Scotland. But nationalism, in various forms, is the driving force across Europe right now. The SNP is the national party of Scotland and so long as Scots believe that it is fighting on their behalf, and seems to be running a competent administration, they will continue to vote for it.