An Islamic State soldier carries the terror group's flag in its capital of Raqqa, Syria, June 29, 2014. Reuters/Stringer

Sweden is charging a 20-year-old man with terrorism for allegedly building a suicide bomb with the intent of staging an attack in Sweden.

The Prosecution Authority said on Thursday that it believed the man had intended to join the jihadist group Islamic State in Syria. Instead, he was detained in Turkey last June and sent back to Sweden.

"My belief is that he obtained, stored and combined liquids and objects with the purpose of making a suicide bomb," prosecutor Ewamari Haggkvist said in a statement. "The criminal act that was in preparation could have seriously harmed Sweden."

The man's identity was not disclosed, in line with usual Swedish legal procedure.