Critics of Labour attacked the party over anti-Semitism in order to deflect attention from the “racist” Tory campaign for mayor of London, a shadow cabinet member has said.

Speaking at Jewish News-Bicom UK-Israel policy conference in Westminster on Wednesday, Shadow international trade secretary Barry Gardiner defended Labour’s record on combating racism.

Mr Gardiner insisted that the Tory campaign to get Zac Goldsmith elected to City Hall in May was the most racist he had ever witnessed.

He said: “I found it extraordinary that the Labour Party, that has always prided itself on opposing racism – it opposed apartheid, it opposed all forms of anti-Semitism – was being taken to task in the media in quite the way it was at a time when the Conservative Party had just run a mayoral election campaign in London which was the most racist campaign that I can ever remember as a major political campaign in this country.

“And I did think there was a certain element of the press that wanted to shift the focus, and blame the Labour Party.

“And it’s not to say that there weren’t problems, and it is not to say they didn’t need to be dealt with but, actually, we had just seen the most racist political campaign I can ever remember, and there was never any apology.”

Labour was rocked by a slew of rows about anti-Semitism in late spring and early summer which saw former London mayor Ken Livingstone suspended while an investigation is carried out into his comments claiming that Hitler supported Zionism in the early 1930s “before going mad and murdering six million Jews”.

Mr Gardiner said that Labour would not tolerate anti-Semitism in its ranks.

“There have been people within the Labour Party, as there have within other political parties, who are, and make, racist statements and make anti-Semiitic statements. They need to be dealt with with the full force of the rules that the political parties possess.

“I don’t really believe that anybody who knows Jeremy Corbyn could doubt his commitment against anti-Semitism, against racism in all its forms.”

Mr Goldsmith has always strongly denied that his campaign for mayor against Labour’s Sadiq Khan had a racist element to it.

Mr Livingstone insists that he was “simply stating historical fact” with his comments about Hitler.

On Thursday, Zac Goldsmith will contend the Richmond Park by-election, after having resigned his position over the Heathrow extension.