A Spaniard who had previously served a prison sentence for his involvement with the 9/11 attackers was arrested in Madrid for allegedly belonging to the Islamic State terror organization, the interior ministry said Monday.

Sources close to the investigation identified him to EFE as Yusuf Galan, a 52-year-old man who in 2005 had been sentenced to nine years and six months in prison for belonging to a terrorist organization and illegal possession of weapons, though he was freed in 2011.

He was the only Spanish member of an al-Qaida cell that was tried and convicted in Spanish courts for the 9/11 attacks.

"After he was freed, he developed a profile similar to that of a cyber-soldier, the second evolution of a jihadist fighter who uses the internet to share, interact with and propagate terrorist ideology," said the interior ministry in a statement.

Despite having insisted to press that he only wanted to live in peace, Galan had continued being the subject of a police investigation, which found that he had renewed his involvement with terrorism online.

The ministry added that the detainee had collected a large amount of information linked to indoctrination which he shared simultaneously on several of his internet profiles and on instant messaging threads.

In addition to indoctrination and recruitment, he allegedly also carried out operational training in combat techniques, publishing "videos that showed him handling bladed weapons with great dexterity alongside highly explicit messages aimed at committing terrorist acts," said the ministry.

According to the statement, Galan was suspected of being particularly involved with the psychological conditioning of new recruits, who he would mentally prepare until they finally showed their willingness to carry out terror attacks.