Sir Keir Starmer is likely to face a leadership challenge in the summer after Labour’s resounding defeat in the parliamentary by-election in Hartlepool raised questions about his strategy, leftwing MPs warned on Friday.

The leader of Britain’s main opposition party, who has sought to return Labour to the centre ground of UK politics, is coming under pressure to tack to the left after the Tories also retained the Tees Valley mayoralty.

Hartlepool and Tees Valley are in north-east England, former Labour heartlands where Boris Johnson made significant inroads at the 2019 general election.

Leftwing Labour MPs said there would be an attempt to wrest control from Starmer within months should he refuse to adopt a more radical policy programme — and if he loses another by-election expected soon in Batley and Spen in West Yorkshire.

“I think this phase of the internal battle will be focused on trying to force [Starmer] to change direction, especially on policy,” said one senior leftwing MP. “But if they don’t and then we lose Batley and Spen and things are looking bad in the polls over the summer . . . [a leadership challenge] becomes likely.”

There was shock in the Starmer team at the extent of the defeat in Hartlepool, which swung from a 3,595 Labour majority to a Conservative one of 6,940.

“Everyone is furious,” said one of his inner circle. A Labour MP added: “I’ve never felt so despondent.”

Starmer, who became leader just over a year ago, hoped that after Brexit, Labour could win back blue-collar workers who had deserted the Remain-leaning party.

Many Leave-supporting working class voters in former Labour heartlands were angry with the party at the 2019 election, and some defected to the Conservatives.

In recent weeks such voters in north-east England sounded apathetic about Labour, according to one shadow minister. “The anger has gone, because we are no longer a threat, and almost no longer relevant,” said the MP.

One Tory who campaigned in the Hartlepool by-election said: “The Labour party doesn’t understand the voters any more. They still assume they will just naturally come back.”

There are ominous parallels in the Conservatives’ continued electoral success in north-east England with how Labour’s once large-scale support in Scotland switched in significant part to the Scottish National party.

Another shadow minister said the Hartlepool by-election result “was the day in which Labour finally discovered it has lost the white working class vote”.

“It feels like traditional Labour voters are leaving in a fundamental way. It has already happened in Scotland and it’s now happening in England in the same way.”

Labour has only won three general elections in the past 40 years, each one under former leader Tony Blair. Then the party forged an electoral coalition between working class voters in manufacturing areas and liberal, urban graduates.

At the 2019 election, Johnson’s Conservatives swept up many of the blue-collar Eurosceptic workers.

As prime minister, Johnson has promised to “level-up” what he calls left-behind areas such as Hartlepool, and has poured investment into Tees Valley, which re-elected Ben Houchen as its Conservative mayor on Friday.

Johnson’s upbeat message about the potential for change — glossing over how the Tories have been in power at Westminster for 11 years — has struck a chord with many voters in down-at-heel towns.

“They voted for us, the people who have been in charge for more than a decade, for change,” said one Conservative campaigner.

Dehenna Davison, the first Tory MP for Bishop Auckland, elected at the 2019 election, said Johnson’s optimism was core to his appeal in Labour’s former heartlands. “When Boris comes along talking optimistically about equal opportunities no matter where you were born . . . that really resonates with people,” she added.

Meanwhile the Johnson government has borrowed hundreds of billions of pounds to keep the economy afloat during the coronavirus pandemic, which has left Starmer’s team struggling for a rival policy narrative.

“Boris’s message is socially conservative and fiscally leftwing, which is appealing in a lot of former Labour heartlands — and indeed the whole country,” said one senior Tory.

But the more elections Johnson wins on promises of bringing tangible improvement to people’s lives, the increasing pressure there will be to make good in his pledges.

Houchen said his success in Tees Valley was a template for how the Tories can win the next general election.

“When I won in 2017 Labour thought it was a fluke, that I wouldn’t deliver on my promise to our local airport and save it from closure,” he added. “They thought I would fail and everything would go back to normal . . . what Labour didn’t realise, and still don’t, is people don’t care about left or right and the latest whispers from Westminster, they care about things being delivered.”

Some senior Labour figures close to Starmer believe the election results reflect a moment of national exhilaration after Johnson’s successful vaccination programme, which could wear off in months.

They also argue that Hartlepool was a freak result because the town would have been won by the Tories in 2019 were it not for Nigel Farage’s Brexit party splitting the Eurosceptic vote.

“Events can be shocking but not surprising,” said one Starmer ally. “We knew there would be a vaccine bounce from around January. Not everything that happens is a referendum on the Labour party.”

Starmer, who is expected to shuffle his shadow cabinet in the summer, told the BBC he would “reconnect and rebuild” after the losses.

But a big Labour row erupted within hours of the Hartlepool result, as allies of Jeremy Corbyn, the party’s former leftwing leader, tore into Starmer.

John McDonnell, shadow chancellor under Corbyn, said Labour had gone into the by-election without a positive narrative given Starmer’s lack of policy promises.

“The Labour party went into this election campaign . . . without putting a campaign based on what you wanted to do or what sort of society you wanted to build, or the policies you want to advocate,” he added. “We should never, ever, do that again.”

McDonnell said Starmer should be given a chance to continue, however, given the Hartlepool result was partly due to “overspill” from Brexit.

Labour rightwingers said the defeat proved Starmer must accelerate towards the centre ground. Phil Wilson, former MP for Sedgefield, Blair’s old constituency, said: “The overhang from the Corbyn era is still there.”

If Labour leftwingers try to defenestrate Starmer this year, they need 40 MPs to call for a leadership election.

One shadow cabinet member insisted Starmer was “untouchable” given the lack of alternative big-hitters in the parliamentary Labour party. “There is no one else,” he said. “You can’t give up on him.”