The 29-year-old Faiçal Errai — in custody since August 2010 — was handed the sentence for working with Ansar Al Mujahideen, a terrorist group linked to Al-Qaeda.
In its ruling, the High Court said Errai ran pro-jihad internet forums and websites which recruited terrorists “to kill or set themselves alight or carry out suicide attacks in conflicts in northern Africa and south-west Asia," according to Spanish media reports.
But while the court was able to show Errai had — from his home in the popular coastal holiday spot of Denia — "been at the disposition of Ansar Al Mujahideen on a permanent basis", Judge Fernando Grande-Marlaska said there was no proof Errai was "an integral part of the network".
The judge added Errai's relationship with the group was always "virtual" and evidence was not on hand to show he "personally knew other members" of the terror group.
Spain's ABC newspaper said the sentence was important because it showed there was a legal difference between being a member of a terror group and simply working with it.
But the conservative daily also commented there was a "very fine line" in cases where groups recruited people for terror campaigns via the internet.