Keir Starmer has removed his political director as part of a wider reshuffle of his team ahead of the Batley and Spen by-election on July 1 where the Labour leader could face defeat.

Baroness Jenny Chapman, Starmer’s closest aide, will instead take up the post of shadow Brexit minister in the House of Lords. The decision follows the departure of Labour’s head of communications Ben Nunn and the transfer of chief of staff Morgan McSweeney to a “more strategic” role.

Meanwhile, Paul Ovenden, deputy head of communications, is also leaving Labour’s team but for family reasons. In May, Starmer replaced his parliamentary private secretary Carolyn Harris with MP Sharon Hodgson.

The reshuffle points to disorder at the heart of the party in the wake of repeated electoral setbacks, including the Hartlepool by-election last month. Labour also shed a net 327 councillors in wider May local elections, and last Friday saw its worst by-election result in Chesham and Amersham.

Starmer’s office and the party refused to comment on Tuesday about Chapman’s move, which was first reported in The Times.

“Keir sold himself as the professional guy who could run a big organisation, I’m not sure how that is working out,” said one senior Labour official.

But one Starmer loyalist said the overhaul of the Leader of the Opposition’s Office, known as LOTO, pointed to a “step change” in his operation.

“Hopefully, it shows that he is grabbing hold of things. There was a period after the local elections when everyone was super down. It has been hard and painful, but hopefully we will have a renewed focus from this point,” they said.

Incoming staff include new director of strategy Deborah Mattinson, a prominent pollster who has written a book about the “red wall” of northern seats seized from Labour by the Conservative party in the 2019 general election.

Chapman was formerly one of Starmer’s closest allies, having been on his front bench team when he was shadow Brexit secretary under former leader Jeremy Corbyn. After she lost her Darlington seat in 2019, she chaired Starmer’s leadership campaign and became political adviser.

However, Chapman was widely blamed for the party’s disastrous result in Hartlepool, having encouraged the selection of a high-profile former Remainer in the heavily Leave-voting seat in north-east England.

Others blamed her for encouraging Tracy Brabin, former MP for Batley and Spen, to run for West Yorkshire mayor.

Brabin’s victory in May led to the upcoming by-election, which the Tories are bookmakers’ favourite to win. A recent Survation poll in the Yorkshire seat gave the Conservatives a six-point lead over Labour.

Chapman was nominated for a peerage by Starmer last year, raising the expectation at the time that she would eventually be promoted.

The Labour leader has complained that building a team from scratch has been difficult during the pandemic with colleagues working from home.

As recently as Christmas, his party was slightly ahead in some polls, but the Conservative’s lead has since widened by more than 10 points — in part thanks to the UK’s vaccination programme.