A Spanish judge has ordered the detention of a Spaniard from the north African enclave of Melilla on suspicion he belongs to an Islamic terror cell.

National Court judge Javier Gomez Bermudez says that Mohamed Said Mohamed should be held because there is evidence he belongs to a group promoting jihad with cross-border bases in Morocco and Melilla.

In a statement Sunday, the judge said the suspect has a previous criminal record for violent armed robbery and there is evidence he was planning to travel to Syria or Iraq to fight for the Islamic State group.

The judge said two members of Said Mohamed's group had already joined Islamic State.

He said the custody was to prevent any tampering with evidence as investigations continue.