One of the alleged Barcelona attack plotters has admitted a bigger attack was planned, say judicial sources. Mohamed Houli Chemlal was testifying in the Madrid high court, where the four surviving suspects are appearing.
He was injured in an accidental blast that reduced a house to rubble in the town of Alcanar last Wednesday.
Assailants went on to kill 15 people and injure more than 100 in a series of attacks in and around Barcelona the following day and early on Friday.
Eight members of the alleged cell are dead - two were killed in the Alcanar explosion, and six were later shot by police.
The last suspect was killed in a vineyard west of Barcelona on Monday.
The surviving suspects were moved, under high security, from Barcelona to Madrid for Tuesday's hearing.
Investigating judge Fernando Andreu was expected to read out the charges against them, likely to span counts of terrorism, murder and possession of arms.
They began giving evidence before the judge in the afternoon.
Mohamed Houli Chemlal was the first to testify, wearing hospital pyjamas. He is still being treated for his injuries after being hurt in the blast in Alcanar the night before the van attack on the Las Ramblas boulevard of Barcelona.
Unnamed judicial sources said he had confessed both to police and in court that a bigger attack had been planned - confirming a theory outlined by police last week.
They found a cache of 120 gas canisters at the destroyed Alcanar house and suggested that the accidental blast prompted the plotters to change the nature of the attack.
Judicial sources told El Mundo that Houli Chemlal told the court the iconic Sagrada Familia cathedral was one of several targets.
Two other suspects were killed in the Alcanar blast, including Abdelbaki Es Satty, the Moroccan imam thought to have been a radicalising influence on the suspects.
The other surviving suspects in court are:
28-year-old Driss Oukabir: he has already protested his innocence. His passport was found in the van which ran amok in the Las Ramblas boulevard in Barcelona, but he says his brother Moussa - who was killed in the attack in Cambrils - had stolen his documents
Mohammed Aalla, 27, alleged owner of the Audi car used in the attack which came eight hours after the Barcelona one, in Cambrils down the coast
Sahal al-Karib, 34, accused of running an internet cafe in Ripoll used to send money to Morocco.
The judge will decide whether to remand the suspects in custody and deny bail as demanded by the prosecutor.
As well as the two who died in the explosion, five attackers were shot dead by police following the Cambrils attack.
The last man to be caught was Younes Abouyaaqoub, a 22-year-old Moroccan thought to have been the driver of the van that rammed into crowds in Barcelona.
He was shot dead after being spotted in a vineyard to the west of Barcelona on Monday wearing a fake explosives belt. Police said he had shouted "Allahu Akbar" ("God is Greatest") and that he was armed with knives.
Tuesday's hearing took place while Ana Suárez, a woman in her 60s killed in the Cambrils attack, 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.
Meanwhile, French Interior Minister Gerard Collomb has confirmed previous reports that some of the alleged attackers made an overnight visit to France days before the attack.
He told BFMTV it had been an "extremely fast return trip" to the Essonne area of Paris on 11-12 August, during which their Audi A3 had been caught on speed cameras. But he insisted the cell had no French links - "they were exclusively Spanish".
Most of the 12 suspects lived in the town of Ripoll, north of Barcelona close to the French border. All were young men of North African descent.