Tom Peterkin: John Swinney is more embattled than ever before

Holyrood defeat for John Swinney over his plans for primary one testing underlined that the education secretary is a more embattled minister than he has ever been before. As finance secretary, Mr Swinney was known for his mastery of his brief. The same cannot be said for the Deputy First Minister since he took over at education more than two years ago.

A large part of that must be down to the sheer number and the complex nature of challenges facing him.

As education secretary, Mr Swinney is experiencing the difficulties of trying to force through radical reform while meeting resistance from local authorities and teachers. There is also the complication that the SNP is no longer in command of a majority administration at Holyrood.

With Ms Sturgeon’s government unable to do as it pleases at Holyrood, last night’s vote was far from the first time a key policy for which Mr Swinney is responsible has found itself in difficulty.

This summer, faced with the prospect of parliamentary defeat, Mr Swinney shelved his Education Bill, which was supposed to be the vehicle for his flagship reforms to hand more powers to headteachers.

It had been envisaged that the bill would introduce a new Headteachers’ Charter giving school leaders the power to set the curriculum, hire staff and control their own finances. Also within its remit were Mr Swinney’s plans to create new regional bodies to support school improvement.

Mr Swinney’s pledge to try and work with councils to introduce the reforms sounded hollow, particularly when it is considered that the Education Bill was supposed to be a highlight of the government’s legislative agenda.

In addition, there has been the guddle of the named person legislation, which comes within Mr Swinney’s portfolio.

Dogged by controversy ever since it was proposed to give every Scottish child a named person, the scheme was condemned as unnecessarily intrusive and proved deeply unpopular.

Despite being introduced with the laudable intention of looking out for children’s welfare, it has been successfully challenged in the Supreme Court – presenting more problems for the education secretary.

Furthermore, Scottish education is suffering from a teacher recruitment crisis. Teacher morale is low and there are even threats of strike action over pay and conditions.

To suffer a humiliation on the scale of last night ups the ante on Mr Swinney, who is now under considerable pressure. To simply say that the problems he faces are down to the complexity of them does not tell the full story. Behind the scenes, some sources are suggesting that Mr Swinney is finding his travails tiresome and is growing a little fed up with the burden that has been placed on him.

That pressure is compounded by Ms Sturgeon’s high-profile promise to make sorting out Scotland’s classrooms her top priority.

Mr Swinney, however, is too much of a trooper to make such an admission himself. Blessed with a robust character and a strong work ethic, Mr Swinney will plough on.

But the long-term nature of his challenge was illustrated this summer when he made an appearance at the Edinburgh Festival Fringe and said it would take a decade to close the attainment gap, which sees rich pupils outperform their poorer counterparts in the classroom.

Closing that gap and improving literacy and numeracy is utterly fundamental to Ms Sturgeon’s decision to stake her and her government’s reputation on its handling of education. But as Mr Swinney admitted, this is a long-term project. Making the sort of strides to turn things around before the 2021 Scottish election will prove tricky, if not impossible. Therefore it follows that opposition parties intend to make the 2021 campaign all about the SNP’s domestic record. After more than a decade in government, it is not just education where there are weaknesses. The missed waiting time targets and financial difficulties suffered by the NHS raise questions about the Scottish Government’s stewardship of health. The recently reshuffled Jeane Freeman looks to be a more proactive health secretary than Shona Robison, a key Sturgeon ally who was said to be growing disillusioned about the challenges facing her when she ran the NHS. But even Ms Freeman has a job on her hands to turn things round by 2021.

The failure of the Scottish Government to drive through its reforms is also evident when it comes to law and order. This week the new justice secretary Humza Yousaf suggested that long-standing and highly controversial plans to integrate Police Scotland and British Transport Police may never come to fruition.

Ms Sturgeon’s uninspiring Programme for Government unveiled earlier this month contained little to suggest that dramatic improvements are in the pipeline.

At this rate, it looks as though the SNP will head towards May 2021 with a domestic record that will be difficult to defend.

So how will Ms Sturgeon and Mr Swinney’s party counter their opponents’ Scottish election strategies?

One option would be for the SNP to revert to type by turning up the heat up on the constitution to distract from public services. Who knows how Brexit will have panned out by then? But whatever happens, it is easy to see why it might suit the SNP to keep banging the drum for Scottish independence with ever increasing vigour.