The imam behind the Barcelona terror cell may have been radicalised in prison by one of the Madrid train bombers, it has emerged.
Abdelbaki Es Satty, who is believed to have been the ringleader in last week's attacks, was sentenced to two years in 2012 for smuggling drugs between Morocco and Spain.
He was jailed alongside Rachid Aglif, aka "The Rabbit", who was serving 18 years for his role in the 2004 bombings, in which 192 people died and more than 2000 were injured.
Sources in Spain said Es Satty had not been religious prior to going into prison and may have fallen under the malign influence of Aglif and other terrorists while in prison.
Despite the revelation, the local police chief in Catalan insisted his force had a "clear conscience" and said they had not missed any obvious opportunities to stop the jihadists.
Josep Lluis Trapero said the terror cell consisted of 12 people with links to the small town of Ripoll, where Es Satty had been operating as an imam since getting out of prison.
However, he said none of those suspected of involvement in the terrorist outrages, which left 14 people dead and more than 50 injured, had been known to the security services.
Locals in Ripoll described how Es Satty, who taught Arabic to local children, regularly travelled to Belgium, which has been central to many of the recent terror plots.
Nourdeni Elhji, 45, a former housemate of Es Satty, described him as a solitary figure who spent most of his time in his sparsely furnished room, on his laptop.
He said he kept all his possessions in a small box, but recently packed everything away and took it all back to his native Morocco.
Elhji said when he returned to Ripoll on Aug 11, he had nothing with him and he disappeared last Wednesday, just hours before an explosion ripped through a suspected bomb factory in a house in Alcanar, 290km away.
Police believe Es Satty and fellow plotter Youssef Aallaa died in the explosion in Alcanar, leaving only Younes Abouyaaqoub - who is believed to have been the driver of the van used in the attack - still at large.
Five other members of the terror cell were gunned down in the coastal resort of Cambrils as they tried to launch a late-night attack.
It is now thought Es Satty radicalised the Moroccan-born group in Ripoll within months, persuading them to carry out a deadly bomb attack, which had it been successful could have claimed hundreds of lives.
Police searching debris at the bomb factory in Alcanar said they had discovered 120 gas canisters and also traces of the explosive TATP, which was used in the Brussels, Paris, Manchester and also the London Tube bombings.
Three vans had been hired in preparation for the attack and the police believe they were planning to pack them with explosives and gas canisters in order to carry out coordinated attacks at tourist hotspots.