Campaigning in the Hartlepool by-election, Sir Keir Starmer said repeatedly that Labour had a “mountain to climb” if it was to regain power.

Now that the votes are in and counted, that task looks every bit as formidable as the party seeks to chart a route back to No 10.

It is hard to see the result as anything other than a personal blow to the Labour leader in his first major electoral test since he was elected a little more than a year ago.

Hartlepool has been Labour since the seat was created in 1974 and its loss is another damaging breach in the once impregnable “red wall”.

Sir Keir Starmer arrives to cast his vote in the London mayoral election
Sir Keir Starmer arrives to cast his vote in the London mayoral election (Dominic Lipinski/PA)

Sir Keir’s supporters can – and no doubt will – point to the underlying electoral dynamics behind the result.

At least in part, it would appear that many of the voters who backed the Brexit Party in the 2019 general election – where it took a quarter of the vote – simply switched to the Conservatives.

But the difficulty for Sir Keir is that he is supposed to be the man to lead the party back to power again after the chaos of the Jeremy Corbyn years.

Hartlepool – once held by Peter Mandelson – is exactly the sort of seat that Labour needs to win if it is to have any realistic hope of ousting the Tories from Downing Street.

How the electoral map of northern England has changed
(PA Graphics)

And it is hardly alone among those constituencies the party did hold in 2019 with a reservoir of Brexit Party voters who may well look to the Conservatives the next time they come to cast their ballot.

It is hard to envisage any immediate threat to Sir Keir’s position – Labour has always been far less ruthless when it comes to dispatching leaders than the Tories.

There will no doubt be sniping from Corbynistas unhappy at the way the left has been effectively sidelined under his leadership, although there is no sign of a sustained challenge.

However, the result – with more bad news for the party potentially still to come as the council election results roll in – comes against a backdrop of growing unease at his performance.

When he first took over the reins, there was relief in the Labour ranks that they now had a leader that voters could actually see as a prime minister in waiting in a way that many never could Mr Corbyn.

As the Government flailed in the early days of the pandemic, Sir Keir proved effective in holding Boris Johnson’s feet to the fire over its failings on PPE and test and trace.

However, since the successful rollout of the vaccine programme around the turn of the year, Labour has been steadily losing ground to the Tories, who have consistently enjoyed a double-digit lead in the polls.

Labour Party leader Sir Keir Starmer
This was Sir Keir Starmer’s first major electoral test since becoming Labour leader (Leon Neal/PA)

Allies of the Labour leader say he has had a tricky path to follow pursuing a policy of “constructive opposition” during the pandemic, pointing out Government failures while largely supporting it on lockdown.

However, he is likely to come under growing pressure to put forward a more positive message as to why voters should turn back to Labour.

Sir Keir has said that he did not want to go too soon while the public were still preoccupied with other matters.

He has however warned that the next election could come as early as spring 2023, and with Labour seeking to overturn its biggest defeat since 1935, the time in which to make an impact may soon start disappearing very fast.