The small Catalan town of Ripoll north of Barcelona is reeling with the news that eight of the 12 jihadist suspects killed or arrested were local residents.
Best known for its Romanesque monastery, Ripoll, with about 11,000 inhabitants, is the last place you would expect a jihadist cell to operate.
Four suspects have appeared in court in Madrid in connection with the attacks in Barcelona and Cambrils that killed 15 people.
Police now believe the young men were brought together and radicalised in Ripoll by a local imam with suspected terrorist links.
The suspects were brothers and friends of mostly Moroccan origin. Some were not out of their teens.
Catalan police chief Josep Lluís Trapero said the cell was believed to be 12 strong, planning the attacks for more than six months.
The van-ramming plot, which killed 13 people and injured more than 100 on Las Ramblas in Barcelona, was carried out after bomb equipment accidentally blew up. That blast wrecked a house in Alcanar, 300km (186 miles) south of Ripoll.
Four were arrested in connection with the attacks: Driss Oukabir, 28, Mohamed Houli Chemlal and Salah al-Karib, 34, and Mohammed Aallaa, 27.
Houli Chemlal confessed that a bigger attack had been planned, judicial sources said after a hearing on Tuesday. He implied that the gas that blew up in Alcanar was to have been used.
He was quoted as saying Barcelona's iconic Sagrada Familia church was among the cell's targets.
Driss Oukabir denied any involvement with the cell. He said he had hired two vans to help his friends move furniture. His passport was found in the Las Ramblas van, but he said his brother Moussa - killed by police with four other suspects - had stolen his documents.
Both Oukabir and Houli Chemlal have been charged and remanded in custody.
Al-Karib is being held for a further 72 hours while investigations continue.
Who are the Ripoll cell?
Hours after the Barcelona attack, police shot and killed five on Thursday night in Cambrils: Moussa Oukabir, 17, Said Aallaa, 18, Houssaine Abouyaaqoub, 19, Omar Hychami, 21 and Mohamed Hychami, 24. The suspects' Audi A3 car had earlier killed a woman in a second vehicle attack.
Mohammed Aallaa - one of the four who appeared in court on Tuesday - is said to be the owner of the Audi A3. Three Aallaa brothers are in the group of suspects. Said was shot by police, and Youssef Aallaa is believed to have died in the Alcanar explosion.
Mohammed Aallaa was released on conditional bail by the judge.
It was confirmed on Monday that the remains of Abdelbaki Es Satty - a local Ripoll imam - were also found at the Alcanar explosion site.
Younes Abouyaaqoub was the only suspect who remained on the run after escaping but was shot dead by police on Monday.
The 22-year-old suspected van driver behind the assault on people in Las Ramblas was seen on CCTV around the area for up to 90 minutes after the attack. He then hijacked a car and killed the driver - who police have confirmed as the 15th victim.
He was eventually killed after a five-day manhunt, wearing a fake explosive belt in rural Subirats, 40km from Barcelona.
In a new twist, it has emerged that Younes Abouyaaqoub and another suspect went on a short trip to Paris in the Audi, the weekend before the attacks.
French BFMTV news reports that the Spanish-registered Audi was caught on a speed camera in the Essonne region, on the edge of Paris.
They stayed overnight at a hotel on the outskirts, then went shopping in Paris, before driving back to Spain, French investigators say.
They are sure that the pair did not also visit Belgium, which is where the bloody November 2015 jihadist attack on Paris was planned.
Who was the ringleader?
Like most of the suspects in the Barcelona attack, suspected mastermind Abdelbaki Es Satty, 45, had Moroccan roots.
The imam moved to the town after being released from a Spanish prison in 2014, where he had spent four years for drug-trafficking offences.
Spanish media report that he struck up a friendship with Rachid Aglif in prison, a Moroccan serving 18 years for his role in the Madrid train bombings which killed 191 people and injured hundreds in 2004.
The mayor of Belgium's Vilvoorde region confirmed Satty had lived in the nearby Brussels suburb of Machelen, in the months leading up to the March 2016 suicide bombings that killed 32 people in the Belgian capital.
A Belgian official told the BBC that the imam had preached at a mosque in 2015 for about five months before local elders became concerned at the "radicalised and polarising" nature of his religious teaching.
He is then thought to have travelled to Ripoll.
A spokesman for the local Muslim community of Ripoll told El País newspaper: "It is getting harder to find an imam, so it was a big surprise when he turned up."
He said Satty lived in a two-bedroom apartment by the monastery and described him as a "loner" and "unobtrusive."
Another acquaintance, quoted by AFP news agency, said Satty "spoke little, spent time with his computer in his room, and had an old mobile phone with no internet, and few books".
The imam apparently left the mosque in June for an extended trip to Morocco, but a housemate told the BBC he had seen him last Tuesday.
His home was searched by police on Saturday, and it is now widely suspected he was the cell's ringleader, and that they implemented the contingency plan that killed 15 people after his accidental death.
In Ripoll, acquaintances of Younes Abouyaaqoub - the driver of the deadly Barcelona van - described him as studious and polite, showing no signs of radicalisation.
One called him "an excellent guy". Abouyaaqoub was a qualified electrical engineer, working for a local firm.
Spain's El Pais daily says Abouyaaqoub was aged four when his family moved to Ripoll from Morocco. Houssaine, one of his four siblings, was among those killed by police in Cambrils.
Younes had a passion for cars - acquaintances said he had owned a Seat Ibiza, a BMW and later a Citroen C5.
Reports say he and at least two others in the cell - Moussa Oukabir and Said Aallaa - played in a local football team, EFS Ripoll.
In late June, after the Muslim holy month of Ramadan, some of the group reportedly began wearing Islamic clothes for the first time.