The British foreign secretary, Jeremy Hunt, has been rebuked by the European commission for a speech at the Conservative party conference where he compared the European Union to the Soviet Union.

Asked to respond to Hunt’s remarks, the European commission’s chief spokesman, Margaritis Schinas, said: “I would say respectfully that we would all benefit – and in particular foreign affairs ministers – from opening a history book from time to time.”

Two former leaders of the Foreign Office and a former president of Estonia were among those who condemned the speech, in which Hunt described the EU as a prison.

Peter Ricketts, who ran the Foreign Office in 2006-10 and is a former ambassador to France, tweeted: “This rubbish is unworthy of a British foreign secretary. The EU isn’t a Soviet-style prison. Its legal order has brought peace and prosperity after a century of war. Our decision to leave was always going to leave us worse off. The only punishment is the self-inflicted variety.”

Sir Simon Fraser, who led the Foreign Office in 2010-15, said he agreed with Lord Ricketts. “Whatever you think about Brexit, shocking failure of judgment for British foreign secretary to compare European Union with Soviet Union,” he wrote on Twitter.

Back in Birmingham, senior government figures expressed concern about Hunt’s remarks, which were widely regarded as a pitch to grassroots Conservative members. With talks at a delicate stage, there were concerns that the foreign secretary’s robust tone could jeopardise Britain’s relationship with its negotiating partners.

The European parliament’s Brexit coordinator, Guy Verhofstadt, said Hunt’s remarks were “offensive and outrageous”. Former Conservative prime ministers Winston Churchill and Margaret Thatcher “those great defenders of European freedom and democracy, must be turning in their graves”, Verhofstadt wrote.

The comparison would have been shocking for many EU member states that were once occupied by the Soviet Union or controlled from Moscow. Donald Tusk, the president of the European council and a former Polish prime minister, was a student supporter of Poland’s anti-communist Solidarity trade union. He lost his job and was evicted from his home when Poland’s rulers cracked down on opponents in 1981, and was later jailed for founding a periodical about liberal economics. He has yet to comment on Hunt’s remarks.

Radosław Sikorski, foreign minister in Tusk’s government, demanded an apology from Hunt, describing comparisons of the European Union to the USSR as “cheap and offensive, particularly to us who have lived in both”. On Twitter he wrote: “Did the Red Army force you to join? How many millions has Brussels exterminated? Gulag for demanding a referendum on independence? Apologise, Jeremy Hunt!”

Latvia’s ambassador to London, Baiba Braže, tweeted: “Soviets killed, deported, exiled and imprisoned [hundreds of] thousands of Latvia’s inhabitants after the illegal occupation in 1940, and ruined lives of 3 generations, while the EU has brought prosperity, equality, growth, respect.”

To dispel the impression of a break in relations, Braže later added she was grateful for Hunt’s “warm words and memories” of his visit to Latvia and “the UK’s contribution to our freedom”.

Toomas Hendrik Ilves, Estonia’s former president, criticised Hunt’s words in a series of withering tweets. “I used to think foreign ministers were the smartest people in democratic governments,” he wrote. However, while serving as Estonia’s foreign minister “I realised then that most of my colleagues from parliamentary democracies were either the head of the junior coalition partner (with little interest in foreign policy) or a crony/competitor of the PM.”

Hunt told party conference delegates he had voted to remain in the EU but now supported leave because of what he called the EU’s “arrogance” during Brexit negotiations. He said the EU seemed to want to “punish” a member for leaving, and likened its tactics to the Soviet Union’s.

“The lesson from history is clear: if you turn the EU club into a prison, the desire to get out won’t diminish, it will grow – and we won’t be the only prisoner that will want to escape,” he said.

“If you reject the hand of friendship offered by our prime minister, you turn your back on the partnership that has given Europe more security, more freedom and more opportunities than ever in history.”

He recalled a recent visit to Latvia, where he laid a wreath at the Latvian Freedom Monument. “In a remarkable transformation, Latvia is a modern democracy, part of both Nato and the EU. And no European country did more to bring about that transformation than Britain,” he said.

Lithuania’s EU commissioner, Vytenis Andriukaitis, also condemned the foreign secretary.

“I was born in Soviet gulag and been imprisoned by KGB a few times in my life,” he wrote on Twitter. Andriukaitis, a medical doctor and historian, was one of the signatories of the Lithuanian declaration of independence in 1990, having been active in the anti-Soviet movement since his teens. His parents were deported to Siberia under Josef Stalin’s orders in 1941 and were only allowed to return separately in 1957-8.

“Happy to brief you on the main differences between EU and Soviet Union. And also why we escaped the USSR. Anytime. Whatever helps.”