Spanish police said on Sunday they had uncovered a cache of 120 gas canisters at a house believed to be the bomb-making factory of suspects in terror attacks that claimed 14 lives, as Barcelona mourned victims of the rampage.
The suspected jihadists had been preparing bombs for "one or more attacks in Barcelona", regional police chief Josep Lluis Trapero told reporters, revealing that traces of TATP explosive had also been found.
But the suspects accidentally detonated an explosive at the house on the eve of Thursday's attack in Barcelona -- an error that likely forced them to modify their plans.
Instead, they used a vehicle to smash into crowds on Barcelona's Las Ramblas boulevard as it was thronged with tourists, killing 13 people and injuring about 100.
Several hours later, a similar attack in the seaside town of Cambrils left one woman dead. Police shot and killed the five attackers in Cambrils, some of whom were wearing fake explosive belts and carrying knives.
The Islamic State (IS) group claimed responsibility for the attacks, believed to be its first in Spain.
Police are hunting a Moroccan man suspected of driving the van used in Barcelona, and warn that he could be at large outside Spain.
"We don't know where he is," said Trapero of the 22-year-old suspect, Younes Abouyaaqoub.
Australian boy among the killed
Three days after the attack that plunged the country into deep grief, locals and tourists turned out in force on Sunday to mourn victims at Barcelona's Sagrada Familia basilica.
King Felipe, Prime Minister Mariano Rajoy and Catalonia's president, Carles Puigdemont, led the 90-minute ceremony, while heavily-armed police stood guard outside and snipers deployed on rooftops.
Catalonia resident Teresa Rodriguez said she came to pray for the victims, who came from three dozen countries, some as far afield as Australia, China and Peru.
The individual tragedies lengthened on Sunday as the family of a seven-year-old British-Australian boy, Julian Cadman, who had been listed as missing, confirmed that the lad was among the 13 killed in Barcelona.
"What happened in Las Ramblas is really hard for us, we go for walks there often, it could have happened to me, my children or anyone. And here we are. It's huge, huge," Rodriguez said, fighting back tears.
Nearly 100,000 people were expected later Sunday at the Camp Nou stadium for Barcelona's first home game of the season, to be marked by a minute of silence for the victims.
Traces of triacetone triperoxide (TATP) -- a homemade explosive that is an IS hallmark -- were also found at the bomb factory in Alcanar, about 200 kilometres south of Barcelona, where the gas canisters were uncovered.
Investigators said they believe the terror cell comprised at least 12 men, some of them teenagers.
An imam, Abdelbaki Es Satty, was among the suspects, police confirmed.
Investigators are seeking to unravel the role of the imam, who is believed to have radicalised many of the youths in a small town called Ripoll at the foot of the Pyrenees.
Several suspects -- including Abouyaaqoub -- grew up or lived in the town of about 10,000 residents.
On Saturday, police raided the imam's apartment in Ripoll, his flatmate, who would only identify himself as Nourddem, told AFP.
Investigators are looking for DNA traces to see if the imam had been blown up in the explosion in Alcanar.
The imam was reportedly known to police, with Spanish media saying he had spent time in prison.
El Pais and El Mundo quoting anti-terror forces said the imam had met prisoners linked to the Al-Qaeda-inspired bombing of Madrid trains that killed 191 people in March 2004 in what remains the worst terror attack in Europe.
A man who identified himself as Moha, 46, who lives in Ripoll, said the imam was initially part of the only mosque in town, but "later left and (set up) his own prayer hall in a garage".
"There has been a change in the community since he arrived more than two years ago," said Moha.
He said youths who used to frequent a Moroccan cafe near the first mosque where they would watch football matches stopped doing so more than a year ago.
In the Moroccan town of M'rirt, relatives of Abouyaaqoub also accused the imam of radicalising the young man, as well as his brother Houssein.
Most of the suspects are children of Moroccan immigrants, including Ripoll-born Moussa Oukabir, 17, one of five suspects shot dead in Cambrils. His older brother Driss is among the four arrested.
In Morocco, their father Said broke down on hearing the news.
"I hope they will say he's innocent... I don't want to lose my two sons," he told AFP.
A cousin said Moussa "loved playing football, having a good time, chatting up girls".