Spain's high court on Tuesday ordered that a 17-year-old student suspected of having links to the Islamic State (ISIS) group and of planning to attack his high school be held on remand at a youth detention center for at least six months, Reuters reported.

The student, a Syrian national, was arrested early on Monday in the southern town of Montellano near Seville, and has been charged with belonging to a terrorist organization and possessing explosives.

Jose Luis de Castro, the judge in charge of the court's section for minors, said in his order that "these felonies of enormous gravity" justified the pre-trial detention.

The judge added that there is "solid evidence" that the suspect obtained various substances used for homemade explosives, as well as manuals for their manufacture and added that the suspect had also pledged loyalty to Islamic State on social media.

The suspect had been living with his mother and 10-year-old sister in Montellano, a town of 7,000 people, for two years. All three have refugee status, according to Montellano's mayor, Curro Gil.

The judge said the youth was "highly radicalized, obsessed with all things military, has camouflage clothing and is tremendously homophobic and antisemitic", according to Reuters.

European countries have been dealing with the issue of radicalization in recent years, as several countries in Europe have been targeted by Islamist attacks.

In December, security authorities in Austria, Germany and Spain received warnings that an Islamist terrorist cell plans to carry out several attacks in Europe on New Year's Eve or Christmas in Cologne, Vienna and Madrid.

Last January, a 25-year-old Moroccan man who was due to be deported from the country attacked two churches in southern Spain, killing one clergyman and seriously injuring another.