Jewish community groups have branded the shadow chancellor’s comparison of Julian Assange’s extradition battle with the 1895 wrongful conviction of Alfred Dreyfus as “deeply offensive”.

After visiting Assange at Belmarsh Prison on Thursday, Labour’s John McDonnell said of his case: “I think this is one of the most important and significant political trials of this generation, in fact longer.

“I think it’s the Dreyfus case of our age.

“The way in which a person is being persecuted for political reasons, for simply exposing the truth for what went on in relation to recent wars.”

Mr McDonnell was referring to the 1895 conviction at a court martial of French officer Alfred Dreyfus on treason charges many felt were brought against him because he was Jewish.

He was later exonerated after a long campaign featuring intellectuals such as novelist Emile Zola, who wrote a denunciation of the prosecution case entitled J’Accuse (I accuse).

Reacting to Mr McDonnell’s comments on Twitter, Mike Katz, national chairman of the Jewish Labour Movement, said: “What an absolutely ridiculous and offensive thing to say.”

He added: “Though I can see how you could confuse Dreyfus, a loyal soldier wrongly accused of treason because he was a Jew, with an entitled bloke who hid in a foreign embassy to evade extradition on a rape allegation.

“If you view *everything* through an anti-American lense, obvs.”

Assange sought asylum in the Ecuadorian embassy in London in 2012 to avoid extradition to Sweden over sex offence allegations, which he has always denied and were subsequently dropped.

Karen Pollock, chief executive of the Holocaust Educational Trust, also tweeted: “Dreyfus was a French artillery officer falsely accused of treason because he was Jewish.

“Go figure how or why John McDonnell could make such an inappropriate comparison with the Assange case.

“Outrageous, ridiculous and so deeply offensive.”

Community Security Trust (CST), a charity working to protect British Jews from anti-Semitism, tweeted: “Disgraceful false equivalence to one of the key learning moments of modern Jewish history.”

A spokesman for the Antisemitism Policy Trust, an organisation that works with parliamentarians to address anti-Semitism, said: “This is a crass and offensive comparison which completely overlooks that Dreyfus was a victim of anti-Jewish racism.”

He added: “This isn’t the first time that anti-Semitism has been missed by the current Labour leadership. John McDonnell should have known better.”

The Equality and Human Rights Commission (EHRC) is currently investigating complaints of anti-Semitism within the Labour Party, along with the actions it took to tackle the issue.