A Moroccan court has convicted 18 men for being part of a criminal band aiming to carry out terror attacks, including a former member of the Spanish military.

The men were arrested in January in six cities across the country and received sentences Friday ranging from three to 10 years.

One of the men was described as a Moroccan-Spanish citizen who served in the Spanish army before resigning and joining al-Qaida in Afghanistan. He received an eight-year sentence.

Morocco regularly announces the dismantling of cells aimed at recruiting fighters for al-Qaida and the Islamic State. It's estimated that at least 1,200 Moroccans have left to fight with extremist groups, mostly in Syria and Iraq. Authorities have expressed fear they will return home to carry out attacks.