Madrid (AFP) - A strong explosion at a house in Alcanar in southern Catalonia, which was initially treated as a simple gas blast, in fact set into motion the twin vehicle attacks which shook Spain, and unified it in defiance.
The accident deprived a jihadist cell of bomb material they planned to use in a larger attack and prompted them to instead use vehicles to plough into pedestrians, killing 14 people.
Police hunting the last suspect in the 12-man cell on Monday shot dead Younes Abouyaaqoub, 22, after a massive manhunt.
Here is a timeline of events:
- April 2017 -
The jihadist cell is already in Alcanar, according to their neighbour Martine Groby, a 61-year-old French retiree.
"They were very discreet, too discreet. The shutters were closed, there was no music, no children, no women," she told AFP.
She said her father, a former policeman, told her the young men living next door were "terrorists" and told her to take down their number plates.
He found it strange that they kept coming and going all day.
"I should have listened to him," said Groby, her eyes welling with tears.
- Wednesday August 16 -
An explosion at a house in Alcanar some 200 kilometres (120 miles) southwest of Barcelona kills two people and seriously injured another. Six people are slightly injured.
Among the dead is a Moroccan imam, Abdelbaki Es Satty, believed to have radicalised youths who carried out the attacks.
The blast is so strong it is heard four kilometres away. Local TV reported the explosion may have been caused by a canister of butane and propane gas.
It was not known at the time that the house stored the ingredients needed to make the Islamic State group's preferred explosive: TATP.
The explosive was used in attacks in London, Paris, Brussels and Manchester.
- Thursday August 17 -
One of the attackers, Said Aallaa, tells his family that he is going out with a friend. He leaves his home in Ripoll in northern Catalonia and travels some 200 kilometres to the seaside resort of Cambrils.
Aallaa was in a car that hours later rammed into pedestrians in Cambrils, leaving one woman dead after one of the assailants jumped out of the vehicle and stabbed her with a knife.
A second, smaller explosion rocks the house in Alcanar. At the time police, who at this point still had not linked the house to terrorism, were removing rubble with an excavator.
Six police officers, two firefighters and the driver of the excavator are injured.
A white van speeds into people along a 500 metre (1,600 feet) stretch of the pedestrian concourse at the centre of Barcelona's most famous street, Las Ramblas, killing 13 people and injuring over 100 others.
The suspect driver and only passenger of the van, Younes Abouyaaqoub, 22, escapes on foot, disappearing into the city's most famous food market and tourist magnet, La Boqueria.
Abouyaaqoub arrives at Barcelona's university zone about six kilometres (3.5 miles) away where he approaches a car and stabs to death its driver, 34-year-old Pau Perez.
He throws Perez's body in the back seat of the Ford Focus and drives away.
Shortly after Abouyaaqoub comes up against a police checkpoint. He forces the stolen car through, injuring a police officer. Police fire shots at the car.
Officers find the stolen car with a body of a man inside in Sant Just Desvern, a town just outside of Barcelona.
Police believe at first that the man died from their gunshots but they later realise he was stabbed. On Monday they announced that the body was that of Perez.
The chief of Catalonia's regional police, Josep Lluis Trapero, says for the first time that the vehicle attack in Barcelona is linked to the explosion at the house in Alcanar.
- Friday August 18 -
Moussa Oukabir, 17, Mohamed Hychami, 24, and Said Aallaa, 18, along with two other unnamed accomplices drive an Audi A3 into pedestrians on the promenade at Cambrils.
They try to force their way through a police checkpoint and injure one officer. They then get out of the car wearing fake explosives belts and armed with knives and axes.
A police officer shoots four of them dead. A fifth attacker tries to flee and another police officer shoots him dead.
Before he was shot he had time to stab a woman who later died, becoming the 15th victim of the attacks.
- Monday, August 21 -
Police shoot dead Abouyaaqoub, the alleged fugitive driver of the van that mowed down crowds in Barcelona, in a village about 60 kilometres (37 miles) west of Barcelona.
He was wearing a fake suicide belt when he was killed and was armed with knives and daggers.
Police said he shouted "God is greater" as he was shot.