Kaplan, a member of the junior coalition partner Green Party, told reporters he was opposed to “all forms of extremism” and stressed his dedication to “human rights, democracy and dialogue.”

The 44-year-old had been in hot water since the weekend when media published old video footage of him making controversial remarks about Israel’s politics towards Palestinians.

During a March 2009 debate on Islamophobia organised by a Somali organisation, Kaplan, who was a member of parliament at the time, said there were “similarities” between the persecution of Jews by Nazi Germany during the 1930s and the everyday lives of Palestinians.

“I have on several occasions criticised the actions of the state of Israel severely, but I am clearly not anti-Semitic… My criticism of Israel does not make me less critical of the anti-Semitism that exists in Sweden,” Kaplan wrote in a comment published on the website of daily Expressen after his resignation was announced.

Last week, media had published photos of Kaplan attending a July 2015 dinner in Sweden with Turkish ultranationalists, which sparked strong reactions from the opposition, media, and the public.

Among those attending the dinner was Ilhan Senturk, the Swedish head of the ultranational “Grey Wolves” organisation known for political violence in the 1970s and 1980s.

Also present was Barbaros Leyani, the former vice-president of the Turkish National Association of Sweden who was forced to resign after calling for the murder of “Armenian dogs” during a demonstration in Stockholm in April.

Kaplan, who was born in Turkey and moved to Sweden when he was eight, also came under fire from media and political opponents for his ties to Islamic organisations, especially Milli Gorus which is suspected of promoting religious fundamentalism.

He acknowledged those ties, but “that doesn’t mean I agree with them on everything,” he told Swedish television.

Opposition leader Anna Kinberg Batra of the conservative Moderates criticised Prime Minister Lofven, a Social Democrat, for “being passive and slow” to react to the controversy.