text: Mohamed Houli Chemlal is one of four surviving suspects who gave evidence.
  He and Driss Oukabir have both been charged with membership of a terrorist organisation and murder.
  Salah al-Karib has been detained pending further investigations, while Mohammed Aallaa was released on bail.
  According to Houli Chemlal, the group's plans - which he had known of "for at least two months - were scaled back when a house packed with bomb-making equipment blew up the day before.
  He was injured in the accidental blast that reduced the house to rubble in the town of Alcanar.
  The Alcanar explosion came the day before Thursday's Barcelona attack in which a van was driven at speed down the main Las Ramblas boulevard, killing 13 and injuring more than 100.
  Judicial sources quoted Houli Chemlal as telling the court a much bigger series of attacks had been planned.
  Assailants killed a total of 15 people in the van attack, the stabbing of a driver whose car was commandeered shortly afterwards, and a car attack in the resort of Cambrils hours later.
  Eight members of the cell are dead - two were killed in the Alcanar explosion, and six were later shot by police, including five after the Cambrils attack.
  The last suspect to be killed was Moroccan-born Younes Abouyaaqoub, 22, believed to be the driver of the Las Ramblas van.
  Wearing a fake explosives belt and armed with knives, he was shot dead by police in a vineyard west of Barcelona on Monday.
  The surviving suspects were moved, under high security, from Barcelona to Madrid for Tuesday's hearing.
  The court session, a preliminary hearing to gather evidence for a future trial, took place behind closed doors.
  Houli Chemlal was the first to testify, wearing hospital pyjamas. He is still being treated for his injuries from the blast in Alcanar.
  Oukabir, whose brother Moussa was among suspects killed after the Cambrils attack, has also given evidence to the Madrid court.
  According to judicial sources, he has changed his story to say that he admits renting the van used in the Las Ramblas attack but thought it was to be used for a house-move.
  Under earlier police interrogation, he is said to have maintained that his brother Moussa hired the van using documents stolen from him.
  Both have been held in jail.
  Two other suspects were killed in the Alcanar explosion, including Abdelbaki Es Satty, the Moroccan imam from the town of Ripoll thought to have been a radicalising influence on the suspects.
  The two other suspects appearing in court were:
  All four suspects giving evidence are reported to have testified that Es Satty was the ringleader of the group.
  As Tuesday's Madrid hearing took place, Ana Suárez, a Spanish woman in her 60s killed in Cambrils, was buried in a private ceremony in Zaragoza.
  Forty-five companies in a Catalonia association of undertakers and funeral companies have offered to perform funerals for the victims without charge.
  Most of the 12 suspects lived in Ripoll, north of Barcelona close to the French border. All were young men of North African descent.
  Police have been conducting new raids -  at an internet café in Ripoll and at an apartment in Vilafranca, south-west of Barcelona.
target: The cell behind the Barcelona van attack had planned to use explosives against monuments including the city's famous Sagrada Familia church, a suspect has told a Madrid court.