MADRID (AP) — Authorities in Spain say security forces there and in nearby Morocco have broken up an alleged extremist cell whose six members were actively training and planning to conduct violent attacks.

Five of those detained on Wednesday are Moroccan and one is a Spaniard of Moroccan origin, Spain’s Interior Ministry said.

The alleged leader of the cell, a 39-year-old Moroccan, lived in Melilla, a Spanish enclave in northern Africa, but was arrested while visiting the neighbouring country. He allegedly recruited youngsters at a re-education centre where he worked and used Islamic State group propaganda to train them, the ministry said in a statement.

Violent attacks in August claimed by IS killed 16 people in and near Barcelona.

Since mid-2015, Spain has arrested 199 people accused of links to extremism.