A Spanish court has sentenced a Moroccan to six years in prison for collaborating with a terrorist group by running Internet sites that worked to recruit jihad fighters.

The National Court in Madrid said in the sentence Tuesday that Faical Errai, 29, had cooperated with police investigations since being arrested in 2010 in the small eastern town of Poble Nou de Benitachell and had admitted to the charges in the trial late last month.

Errai ran pro-jihad Internet forums for the Ansar Al Mujahideen cyber network linked to al-Qaida. The sites recruited fighters to go to Afghanistan, Chechnya and Somalia.

However, the court acquitted him of charges of belonging to a terror group.