Surveillance cameras caught a group of roughly 10 individuals, some wearing face masks, coming up to the building and throwing a flaming object into the yard of Gothenburg's synagogue.
Prosecutors told Swedish Radio that the detained suspects, age 18 and 21, live in Gothenburg but are citizens of a country that neighbors Israel.
They believe US President Donald Trump's decision to recognise Jerusalem as Israel's capital helped trigger the attack.
Politicians praised for "forceful" response to antisemitism4:06 min 4:06 min
Sweden to call Security Council meeting over Jerusalem1:04 min 1:04 min
"Ring of Peace" around Stockholm synagogue9:40 min 9:40 min