The extremists from the organization "Islamic Brotherhood for the Preaching of Jihad," planned to take a person hostage, dress him in an orange jumpsuit, similar to the one used by the ISIL militants in their recorded executions of foreigners, interrogate and then behead him, all the while capturing the process on video, El Pais newspaper said, quoting a source at the National High Court.
In addition, detainees were reportedly planning to take the director of one of the Spanish financial institutions hostage in order to demand a ransom, as well as to plant a bomb at a Jewish bookstore in Barcelona.
The source said the extremists' plans were stopped "at an early stage."
The suspects originate from Morocco, Spain and Paraguay.
In March, Spain arrested eight people, five of whom were of Moroccan descent, who were members of the jihadist group and allegedly tried to recruit young Spanish nationals into the ranks of the Islamic State.
The ISIL is a jihadist militant group that operates mainly in Iraq and Syria where it has captured large territories and declared a caliphate on the areas under its control.
The group is known to be posting online videos of the executions of foreign hostages. The ISIL recruits new members from different parts of the world, including from Europe and the United States. The extremists use social networks as a tool to recruit teenage fighters.
Spain is a member of the US-led coalition currently fighting against ISIL militants.