A comparison made by Boris Johnson, the former London mayor, that the European Union is pursuing similar goals to Hitler in trying to create a powerful superstate has drawn sharp criticism from fellow politicians and the public of the "In" camp.

Johnson, who as a Conservative MP is a leading campaigner for Britain to leave the EU at a June 23 referendum, said in an interview published in The Sunday Telegraph on Sunday that a unifying authority was doomed to fail.

"Napoleon, Hitler, various people tried this out, and it ends tragically," he was quoted as saying in the interview.

Hilary Benn, foreign affairs spokesman for the opposition Labour party, said Johnson had lost his moral compass.

"After the horror of the second world war, the EU helped to bring an end to centuries of conflict in Europe and for Boris Johnson to make this comparison is both offensive and desperate," Benn said in a statement.

However, Johnson received staunch support from senior Tories backing Brexit. Iain Duncan Smith, the former work and pensions secretary, said it was legitimate to draw "historical parallels".

"It's a historical fact of life that if you go through Napoleon, Hitler, everyone else," he told the BBC.

"I think the whole process of trying to drive Europe together by force or by bureaucracy ultimately makes problems."

Johnson's comments also caused a furore on social media as hundreds of people accused the British politician of "scare mongering" and "losing his moral compass".

But Johnson also received support from some people who said his comments were "taken out of context".

Johnson, a frontrunner to succeed Cameron as leader of the Conservative party, has emerged as one of the most important voices in the "Out" campaign in advance of the June vote.

Cameron, who is leading the "In" campaign, has argued that Britain's membership of the EU makes the country more secure, more influential and more prosperous.

He also says Britain, which is not part of the single-currency eurozone, will not be dragged into ever closer union among the EU's member states.

An opinion poll published on Saturday suggested that twice the number of voters believed Johnson was more likely to tell the truth about the EU than Cameron.

With less than six weeks to go until the referendum, voters are evenly split between wanting to remain in the EU and preferring to leave, opinion polls have shown.