Madrid - 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 on Tuesday, according to a judicial official.The suspect, Mohamed Houli Chemlal, was one of four men taken before Spain's National Court in Madrid to testify about the Islamic cell that attacked pedestrians in Barcelona and the nearby seaside town of Cambrils last week.National Court Judge Fernando Andreu questioned the four about the vehicle attacks as well as the fatal explosion at a bomb-making workshop that police said scuttled the group's plot to carry out a more deadly attack at unspecified Barcelona monuments.After the session, the judge ordered two of the surviving suspects held without bail, another detained for 72 more hours and one freed with restrictions.A Spanish judicial official said Houli Chemlal, 21, and suspect Driss Oukabir, 28, identified imam Abdelbaki Es Satty as the ideological leader of the 12-man cell.READ: Spain suspect says terror cell planned big attack on monumentsExplosives accidentOukabir and the other two surviving suspects who testified, Mohamed Aalla and Sahal El Karib, denied being part of the cell, said the court official, who was not authorised to discuss the case and insisted on speaking anonymously.The cell's other eight members are dead.Police shot five during an attack on Friday and one more on Monday after a manhunt.Es Satty and another accidently blew themselves up 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 to by police as suspected members of the cell. Police identified his remains amid the rubble of the August 16 explosion that destroyed the house in Alcanar.Police found in the house over 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 August 17 by a van that mowed down people on Barcelona's famed Las Ramblas promenade and another early on August 18 in Cambrils.The attacks and a bloody getaway in which a man was stabbed to death left 15 dead and over 120 wounded.Only survivorHouli Chemlal, the only survivor of the Alcanar blast, told the court on Tuesday that he was 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 hospitalised under guard since his arrest on Thursday.The second suspect interrogated, Oukabir, testified he rented the vans used in the attacks on pedestrians, but said he 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 his documents were stolen by his brother - was something he had done out of fear.The person spoke on condition of anonymity to discuss the hearing.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, the judicial official said.Police said 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 café in Ripoll, told the judge that he was only trying to make a profit when he bought at least two plane tickets for two alleged members of the cell.EvidencePolice later on Tuesday raided the cyber café in Ripoll as well as a house in Vilafranca del Penedès, searching for more evidence.After the questioning, the judge said there was enough evidence to hold Houli Chemlal and Oukabir on preliminary charges of causing homicides and injuries of a terrorist nature and of belonging to a terrorism organisation.Houli Chemlal also has an additional charge of dealing with explosives.However, the judge ruled the evidence was "not solid enough" to keep holding Aalla, who was freed on condition he appear in court weekly, relinquish his passport and not leave Spain.El Karib will remain in custody for at least 72 more hours while police inquiries continue, the judge said.The lone fugitive from the initial attack, 22-year-old Younes Abouyaaqoub, was shot to death on Monday August 21 west of Barcelona after a big, days' long 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 that barrelled through Barcelona's crowded Las Ramblas promenade and that he hijacked a car and fatally stabbed its driver while making his getaway.Abouyaaqoub's brother and friends made up the rest of the 12-man extremist cell, police said.Chemlal was born in Melilla, one of Spain's two North African coastal enclaves that have borders with Morocco. Spanish media say the other 11 suspects are all reportedly Moroccans who lived in Spain.