Four alleged members of a terror cell were in a Madrid court on Tuesday, facing possible charges related to the twin attacks in Catalonia that claimed 15 lives and wounded more than 100 people.
Spanish police shot dead Barcelona terror suspect Younes Abouyaaqoub on Monday in a dramatic end to the manhunt for the Moroccan national, who shouted "Allahu Akbar" (God is greatest) when he was killed.
The Moroccan was the last fugitive member of a 12-man cell suspected of plotting last week's vehicle attacks in Barcelona and the seaside resort of Cambrils.
Besides the four men detained, the rest were killed, either by police or in an explosion believed to have been accidentally detonated by the suspects themselves in their bomb factory at the seaside town of Alcanar.
Among those killed in the explosion was a Moroccan imam at the heart of the cell, Abdelbaki Es Satty, Catalan police chief Josep Lluis Trapero confirmed.
While Spanish police say the cell has been dismantled, investigators are trying to determine if it had logistical or other forms of support from other individuals.
Questions are also arising about the group's possible international connections.
In Belgium, the mayor of the Vilvorde region told AFP that Satty spent time in the Brussels suburb of Machelen -- next to the city's airport -- between January and March 2016.
On the other side of Brussels, the Molenbeek suburb has gained notoriety as a hotbed of international jihadists after the Brussels bombings in March 2016 and the Paris attacks in November 2015.
And in France, Interior Minister Gerard Collomb told BFMTV that the Audi A3 used to mow down people in Cambrils had been detected by speed cameras in the Paris region while making "a very rapid return trip" days before the Barcelona attack.
Collomb is due to host his Spanish counterpart Juan Ignacio Zoido on Wednesday for talks due to include anti-terrorism cooperation.
At least one of the suspects also spent a night in Zurich last December, said Swiss police, adding that it was too early to speculate about any connections with Switzerland.
On Tuesday under heavy security, police vans carrying the suspects entered the National Court, which deals with terrorism cases, where a judge will decide what -- if any -- charges to press against the four men who allegedly formed part of the cell.
The four suspects in court include Driss Oukabir, the older brother of Moussa who was killed by police in Cambrils on Friday morning along with four other suspects.
Mohamed Aallaa, Mohamed Houli Chemlal, who was injured in the explosion in Alcanar, and Salh El Karib were also in court.
Chemlal, dressed in hospital patient clothing and with his right hand bandaged, was brought in after a doctor determined that he was fit for interrogation, a court spokesman told AFP.
Veteran magistrate Fernando Andreu is due to determine which charges to file against the four men and what role they may have played in the terror plot.
The first hearing lasted about 70 minutes, a court spokesman said.
At the end of the day, Andreu is due to decide if he would send the four to provisional detention.
Trapero said some of the men had given information to police during questioning, and that the elements would be weighed up by investigators.
Investigators seeking to unravel the terror cell had homed in on the small border town of Ripoll at the foot of the Pyrenees mountains in northeastern Spain.
Satty, aged in his 40s, came under scrutiny as he is believed to have radicalised youths in Ripoll.
Police said the imam had spent time in prison and had once been in contact with a suspect wanted on terrorism charges but was never himself charged with terror-related incidents.
The suspected jihadists had been preparing bombs for "one or more attacks in Barcelona", Trapero said Sunday, revealing that 120 gas canisters and traces of TATP components -- a homemade explosive that is an IS hallmark -- had been found at their bomb factory.
The accidental explosion in the house in Alcanar, south of Barcelona, may have forced the suspects to modify their plans.
Instead, they used a vehicle to smash into crowds on Barcelona's Las Ramblas boulevard, killing 13 people and injuring more than 100.
While on the run, Abouyaaqoub, 22, stabbed to death the driver of a car he hijacked to get away.
Several hours later, a similar vehicle attack in Cambrils left one woman dead. Police shot dead the five attackers there, some of whom were wearing fake explosive belts and carrying knives.
Abouyaaqoub was gunned down on Monday in a village about 60 kilometres (40 miles) west of Barcelona, after receiving multiple tip-offs.
Police opened fire as the Moroccan suspect appeared to be wearing an explosive belt, which turned out to be fake.
Fifteen people were killed in the attacks, with the victims from three dozen countries including those as far afield as Australia, China and the United States.