Spanish police say the suspects in yesterday's terror attacks in Barcelona and Cambrils were planning to use explosives in one or more bigger attacks than those carried out.
However, the devices were lost in an accidental detonation two days ago and the attackers had to revise their plans - using vehicles as weapons to ram crowds.
A van driver fled after speeding along a pedestrianised section of Las Ramblas yesterday, the most famous boulevard in Barcelona, killing 13 people and injuring scores of others in the latest of a string of attacks across Europe in which militants have used vehicles as weapons.
Hours after the van rampage, police shot dead five people in the Catalan resort of Cambrils, 120kms down the coast from Barcelona, after they drove their car at pedestrians and police officers.
The five assailants had an axe and knives in their car and wore fake explosive belts, police said.
The driver of the van in Barcelona was one of five men shot by police in Cambrils hours later, Spain's El Pais and El Periodico newspapers reported.
There was no immediate confirmation of the reports.
Josep Lluis Trapero, police chief in Spain's northeastern region of Catalonia, had said earlier that it was possible, but not confirmed, that the driver was among those killed.
A Spanish woman was killed in the Cambrils incident, while several other civilians and a police officer were injured.
- Timeline - Terror attacks in Europe
- Attacks in Spain: What we know
- Irish family injured in attack
- Spanish police foil second attack
- Barcelona incident echoes other attacks
Police have arrested four people in connection with the attacks, three of them Moroccan and one from Spain's North African enclave of Melilla, Mr Trapero said.
They were aged between 21 and 34, and none had a history of terrorism-related activities.
Police were searching for a man called Moussa Oukabir in connection with the attacks, a police source said, but it was unclear what his suspected role may be.
Aged 17 or 18 and of Moroccan origin, he is the younger brother of one of the men arrested yesterday, according to Spanish media reports.
Mr Trapero said the two attacks in Catalonia had been planned for some time by people operating out of the town of Alcanar, southwest of Barcelona.
Alcanar was the scene of an explosion in a house shortly before midnight on Wednesday, which police are linking to the attacks.
The so-called Islamic State said it was behind the attacks.
Of 126 people injured in the two attacks, 65 were still in hospital and 17 were in a critical condition.
The dead and injured came from 34 countries, ranging from France and Germany to Pakistan and the Philippines. Spanish media said several children were killed.
A judicial source said investigators believed a cell of at least eight people, possibly 12, may have been involved in the Barcelona and Cambrils operations and that it had been planning to use gas canisters.
As Spain began three days of mourning, people laid flowers and lit candles in memory of the victims along Las Ramblas.
Prime Minister Mariano Rajoy and King Felipe visited Barcelona's main square nearby to observe a minute's silence.
Defiant crowds later chanted "I am not afraid" in Catalan.
Foreign leaders voiced condemnation and sympathy, including French President Emmanuel Macron, whose nation has suffered some of Europe's deadliest recent attacks.
He tweeted: "All my thoughts and France's solidarity to the victims of the tragic attack in Barcelona."
The Spanish royal family issued an unusually strongly worded statement: "They are assassins, criminals who won't terrorise us. All of Spain is Barcelona."
A minute of silence was observed in Spain at 1pm Irish time in memory of the victims.
World leaders have expressed outrage over the attack as well as solidarity with the victims, while flags are flying at half mast in front of the EU Commission headquarters in Brussels.
Taoiseach Leo Varadkar expressed his abhorrence at what he described as a callous and cowardly act.
He extended the Government's sympathy and that of the nation to the people of Spain.
The United States condemns the terror attack in Barcelona, Spain, and will do whatever is necessary to help. Be tough & strong, we love you!— Donald J. Trump (@realDonaldTrump) August 17, 2017
US President Donald Trump said: "The United States condemns the terror attack in Barcelona, Spain, and will do whatever is necessary to help." He added: "Be tough & strong, we love you!"
Russia President Vladimir Putin called for the world to unite in an "uncompromising battle against the forces of terror".
Islamist militants have staged several attacks across Europe in the past 13 months, killing over 100 people in Nice, Berlin, London and Stockholm.
In March 2004, Islamist militants placed bombs on commuter trains in Madrid, killing 191 people.