Spain's Interior Ministry says police have arrested a Moroccan man they believe was studying intensely on the internet to carry out attacks against civilians for the Islamic State armed group.

A ministry statement Wednesday said the man spent many hours viewing and spreading IS-related video material and displayed a fanaticism that fitted the profile of a dangerous "lone actor" recruited to carry out attacks.

He was arrested in the town of Aranjuez, just south of Madrid, where he lived.

The ministry said much of the material he received and sent concerned late al-Qaida leader Osama Bin Laden and four extremists who blew themselves up in Spain in 2004 following the Madrid train attacks.

Spanish police have arrested 169 individuals suspected of forming part of Islamic extremist groups since 2015.