Sir Keir Starmer said Labour would not fight “yesterday’s wars” as he defended the party’s pro-EU candidate in the Hartlepool by-election.

Dr Paul Williams, who was an opponent of Brexit and backed a second referendum, is standing in the constituency in which almost 70% voted to Leave in the 2016 referendum.

Sir Keir said: “We have left the EU, neither Paul nor I are suggesting a people’s vote, we have left the EU, we have got a deal, we have got to make it work and we don’t want to rejoin.

“That’s the position of the Labour Party.

“We can’t go on fighting yesterday’s wars. The referendum was five years ago now, we don’t want further division. We accept we’ve left, we’ve got a deal, let’s make it work.”

The by-election will be a key test of Sir Keir’s leadership as he seeks to defend a seat in Labour’s heartlands after so much of it fell to Boris Johnson’s Tories in the 2019 election – with Brexit a major factor.

The UK’s exit from the European Union and the deal struck at the end of 2020 may have changed the political landscape, but the contest will be an indication of Sir Keir’s ability to connect with voters in the so-called “red wall” of traditionally Labour seats.

Sir Keir said the contest would offer a choice between a frontline NHS doctor and a Government “that actually wants to cut, effectively, the pay of those who have been working on the front line in the pandemic”.

The Labour leader also defended Dr Williams after he apologised for his past “inappropriate” tweets, including one about “a favourite Tory milf”.

Dr Williams said on Friday that he “wouldn’t dream of making comments like this now” after the decade-old messages came to light.

The former MP was selected as the constituency’s candidate after Mike Hill resigned from the Commons amid sexual harassment allegations.

In one tweet sent in 2011, Dr Williams said: “Do you have a favourite Tory MILF? Mind-blowing dinner table conversation @ #ppw11.”

Sir Keir said: “The moment I was challenged on that I said it’s inappropriate, he shouldn’t’ have done it, it’s wrong, he has deleted it and apologised.

“It’s inappropriate and I’m not going to shirk from that.”

The Labour leader also faced criticism from Unite union boss Len McCluskey, who warned Sir Keir will be “dumped into the dustbin of history” if he continues his attacks on the party’s left.

Mr McCluskey accused the Labour leader of going back on the positions he took when he ran to replace Jeremy Corbyn last year.

He told Times Radio that Sir Keir needed to “shake off the siren voices of New Labour” if the party was to stand any chance of regaining power.

Sir Keir said: “We haven’t spoken for some time. Len and I have got a pretty straightforward relationship: when we agree, we agree; when we disagree, we agree to disagree.

“We are two grown-ups. Len and I disagree on a number of things and we know that we disagree on a number of things.”

Sir Keir was challenged during his LBC phone-in by a Labour supporter who said “you don’t speak to me because I can’t decipher what you actually stand for”.

The Labour leader said: “I want to change things for the better, I want to make sure that as we come out of this pandemic we use it as an opportunity to say ‘Britain can be better than this, we don’t want to go back and patch up where we were when we started, we want to go onto something much better for the future’.”