2023 was the year Labour dared to envisage the prospect of a return to power at Westminster - and Holyrood.

Gone was the reluctance among members to put themselves forward to stand for election, gone too the struggles to get activists to turn out on the campaign trails.

And while not so long ago voters' doors remained shut in the faces of even the most determined party canvassers, now they're opening opening.

“People wanted to talk to us,” Scottish Labour's deputy leader Jackie Baillie - made a Dame in King's birthday honours in June - told The Herald's Political Editor Tom Gordon in an interview earlier this month after she was named our paper's Politician of the Year.

READ MORE: Dame Jackie Baillie on Holyrood elections and Labour's revival

The turnaround in the party's fortunes on both sides of the border was evidenced in a string of parliamentary by-election victories.

Three by-elections in Tory seats were held on July 20 amid the fall out of Boris Johnson's resignation in the wake of the Partygate scandal and the inquiry by the Common's privileges committee into whether the former Prime Minister misled parliament into lockdown parties at Downing Street.

Selby and Ainsty in North Yorkshire brought the first triumph in a vote called by the resignation of Conservative MP and Boris Johnson ally Nigel Adams.

The Herald:

A protester, who named himself as Yaz Ashmawi, throws glitter over Labour leader Sir Keir Starmer before his keynote speech at the Labour Party Conference in Liverpool, Tuesday October 10, 2023. Photo: Stefan Rousseau/PA Wire.

Labour's Keir Mather took the former Tory stronghold overturning a 20,137 Conservative majority, with the 25-year-old landing himself the title reserved for the youngest MP in the House of Commons 'Baby of the House'.

His victory set a record for the largest majority ever overturned by Labour in a by-election.

However, despite the massive win in North Yorkshire there was disappointment that the party failed by just 495 votes to unseat the Tories in Johnson's more marginal seat of Uxbridge and South Ruislip.

READ MORE: Ian Murray: Election will be referendum on Tories - and SNP irrelevant

In the third by election of the day, Sarah Dyke of the Lib Dems managed to oust the Tories in Somerton and Frome following the resignation of David Warburton who had been suspended from the Conservatives over allegations of sexual misconduct which he described as "malicious".

The two Tory defeats were a boost for Labour, though also gave the party food for thought as it prepared for a by-election in South Lanarkshire.

The Herald: Anas Sarwar MSP, leader of Scottish Labour pictured at Labour's campaign HQ in Burnside ahead of the Rutherglen and Hamilton West by-election. Photograph by Colin Mearns.16 August 2023.

Former SNP MP Margaret Ferrier was removed by her constituents in Scotland's first recall petition, following her suspension from the Commons for breaching Covid laws, and the starting gun for the contest was fired in August with Labour looking confident from the off.

Labour was keen to make sure errors at Uxbridge were not repeated.

READ MORE: Who are the Scottish Labour MP hopefuls?

UK party leader Sir Keir Starmer blamed the Uxbridge defeat on Labour's London mayor Sadiq Khan's plans to extend controversial Ulez (ultra-low emission zone) to the area.

READ MORE: Part Two: Who are the Scottish Labour MP hopefuls?

Starmer told journalists: “Ulez was the reason we didn’t win there yesterday. We know that. We heard that on the doors. And we’ve all got to reflect on that, including the mayor.”

In Scotland, sensing low emisssion zones could be a vote loser, Labour had already adopted a sceptical stance towards the Glasgow LEZ zone, brought in in Junem with the party's councillors in the city calling for it to be delayed by a year.

The Herald: Anas Sarwar on campaign trailAnas Sarwar MSP, leader of Scottish Labour and Dame Jackie Baillie MSP, Scottish Labour deputy leader pictured speaking to people at Westcraigs, Blantyre ahead of the Rutherglen and Hamilton West by-election. Photograph by Colin Mearns, 16 August 2023.

When less than a month before polling day SNP Glasgow city council raised the prospect of congestion charging for non residents, on top of any LEZ charges, Labour were quick to seize on the opportunity presented.

Dame Baillie blasted: “The SNP seem intent on heaping misery on Scots, with council tax rises, income tax rises and now additional charges for getting to work.”

Other local issues came to the fore in the Rutherglen by election with Sarwar reportedly stepping in to persuade the leader of Labour led North Lanarkshire Council Jim Logue that announcing the closure of 39 leisure centres and swimming pools less than a week before polling day was not a good idea. The plans were withdrawn two days before the by-election.

READ MORE: Anas Sarwar: Scottish Labour can beat SNP at general election

The victory when it came was a sensational one for Labour - and a huge shock for the SNP.

Candidate Michael Shanks, a modern studies teacher, beat the SNP's Katy Loudon with 17,845 votes - more than double the number polled by Loudon - with the result marking a swing of 20.4% from the SNP to Labour.

The Herald: Scottish Labour MSP Pauline McNeill calls for a ceasefire in Gaza during a demonstration in Glasgow against the killings of Palestinian civilians by Israel.  Photo: Colin Mearns.

Starmer said it was a "seismic" night and that people in Rutherglen and Hamilton West had sent "a clear message".

He added: "I have always said that winning back the trust of people in Scotland is essential. Tonight's victory is the culmination of three-and-a-half years of hard work and humility on that journey."

READ MORE: Analysis: Are the tectonic plates shifting in Scottish politics?

Shanks' victory doubled the number of Scottish Labour MPs to just two, but his win represented a turning point for the party.

It was also the perfect backdrop for the party for its UK conference in Liverpool which got underway on October 7.

Shanks was given a prominent role on the stage of the main hall. Much of the chat among delegates in the cafes and bars was the party's nascent revival north of Border which many had thought had been a very distant prospect.

READ MORE: Labour's Michael Shanks says independence supporters are rejecting SNP

Of course much of Labour's revival was related to the troubles facing the two parties of government, the SNP in Holyrood and the Conservatives in Westminster.

In the wake of the partygate scandal and the deepening cost of living crisis amid the financial chaos and mortgage rates hikes of Liz Truss's premiership, support for Labour across the UK soared. Polls gave the party a steady lead of more than 20 percentage points ahead of the Conservatives in Westminster voting intention.

Meanwhile, in Scotland even before Nicola Sturgeon announced her resignation as SNP leader and First Minister in February - and the tumultuous political events that followed her departure from office -  her party were beginning to lose some support among voters to Labour.

Towards the end of last year Labour figures were hopeful of winning around a dozen seats at the next general election as former voters, many of them Yes voters in 2014, and who had switched to the SNP in the wake of the independence referendum began to consider switching back as progress halted towards independence and their focus settled on removing the Conservatives from power in Downing Street.

To this group of soft Yes voters, Starmer'sand Sarwar's message that the general election was a referendum on the Tories had more appeal that the SNP's that it was a referendum on the constitution and on independence.

As the SNP's troubles exploded in the wake of a bitter leadership contest and the ramping up of the police investigation, the arrests of Peter Murrell, Colin Beattie and finally Nicola Sturgeon (all three were released without charge pending further inquiries) polls suggested the trickle of former Labour voters moving back to support the party was becoming a steady stream.

There have of course been problems too.

Tensions surfaced in the autumn between Starmer and Sarwar over Gaza with the UK party leader reluctant to back calls for  ceasefire in contrast to the latter.

Nevertheless, as we head towards 2024 and a general election, it is hard to see such differences slowing Labour's momentum.

It is an indication of just how far the party has come in 12 months, that while at the turn of the year it thought winning 12 Scottish seats in Westminster would be a remarkable achievement, it is now contemplating becoming once again the biggest party in Scotland and returning to power in Holyrood.