An extremist cell was preparing bombs for an imam who planned to blow himself up at a Barcelona monument, a key suspect in the attacks that killed 15 people in north-eastern Spain told a judge, according to a judicial official.
The suspect, Mohamed Houli Chemlal, 21, was one of four men brought before Spain's National Court in Madrid on Tuesday to testify about the Islamic extremist cell that attacked pedestrians in Barcelona and the nearby seaside town of Cambrils last week.
National Court Judge Fernando Andreu is scheduled to rule later on the prosecutor's request to send the four to jail without bail for preliminary accusations of being part of a terrorist organisation, homicide, causing havoc and dealing with explosives.
A Spanish judicial official said Houli Chemlal and suspect Driss Oukabir, 28, identified the imam, Abdelbaki Es Satty, as the ideologist of the cell.
Oukabir and the other two surviving suspects who testified on Tuesday, Mohamed Aalla and Sahal El Karib, denied being part of the cell, said the court official.
Eight members of the cell have either been killed by police - five were shot dead on Friday and one on Monday after a manhunt - or accidently blew themselves up, like Es Satty and another man, while preparing explosives in a house in the coastal town of Alcanar, south of Barcelona.
Es Satty preached in a mosque in the north-eastern town of Ripoll, home to most of the 12 pointed by police as being possible members of the cell.
Police have identified his remains amid the rubble of the August 16 explosion that destroyed the house in Alcanar.
Messages are displayed at an impromptu memorial at the site where a van crashed into pedestrians at Las Ramblas in Barcelona Photo: REUTERS/Albert Gea
Police found in the house more than 100 tanks of butane gas and materials to make TATP, an explosive frequently used in attacks by Islamic State militants.
The group has claimed responsibility for both attacks on pedestrians - one on Thursday by a van that mowed down people on Barcelona's Las Ramblas promenade and another early on Friday in Cambrils.
The attacks and a bloody getaway in which a man was stabbed to death left 15 dead and more than 120 wounded.
Houli Chemlal, the only survivor of the Alcanar blast, told the court on Tuesday he is alive because he was on the ground floor of the house washing dishes after dinner.
He testified from a wheelchair without lifting his eyes up from the ground, according to the court official. He has been in hospital under guard since his arrest on Thursday.
The second suspect interrogated, Oukabir, testified that he did rent the vans used in the attacks on pedestrians but thought they were going to be used for a house move.
His brother Moussa was one of the five radicals shot dead on Friday by police in Cambrils.
According to another person who attended Tuesday's interrogation, Oukabir told the prosecutor that his first version of events - telling police that his documents were stolen by his brother - was something he had done out of fear.
The third suspect, Aalla, said an Audi A3 used in last week's attack in Cambrils was registered under his name but used by another sibling, according to the Spanish judicial official.
Police say one of Aalla's younger brothers died in Cambrils and another one is believed to be the second casualty in the Alcanar house blast where the imam died.
The last surviving suspect, El Karib, the owner of a cyber cafe in Ripoll, told the judge on Tuesday that he was only trying to make a profit when he bought at least two plane tickets for two alleged members of the cell.
Police later on Tuesday raided that cyber cafe in Ripoll as well as a house in Vilafranca del Penedes, searching for more evidence.
The lone fugitive from the cell - 22-year-old Younes Abouyaaqoub - was shot dead on Monday west of Barcelona after a massive manhunt. Police say he flashed what turned out to be a fake suicide belt at two officers who confronted him in a vineyard.
Police said they had "scientific evidence" that Abouyaaqoub drove the van through Barcelona's crowded Las Ramblas promenade and that he hijacked a car and fatally stabbed its driver while making his getaway.