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 hashish 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 2,000 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 prison.