By Andrés González, Angus Berwick and Carlos Ruano
BARCELONA (Reuters) - Spanish police shot dead five would-be attackers after confronting them early on Friday in a town south of Barcelona where hours earlier a suspected Islamist militant drove a van into crowds, killing 13 people and wounding scores of others.
Islamic State said the perpetrators had been responding to its call for action by carrying out Thursday's rampage along Barcelona's most famous avenue, which was thronged with tourists enjoying an afternoon stroll at the peak of the summer season.
Bodies, many motionless, were left strewn across the avenue and authorities said the toll of dead, which included several children, could rise, with more than 100 injured.
Hours later in the early hours of Friday, as security forces hunted for the van's driver, police said they killed five suspects in Cambrils, 120 km (75 miles) south along the coast from Barcelona, to thwart a separate attack.
The five men attempted to drive into tourists on the Cambrils seafront, police said. Their car overturned and some of them began stabbing people. Four were shot dead at the scene and the fifth was killed a few hundred meters away, police said.
One civilian - a Spanish woman - was killed in the Cambrils incident while several other civilians and a police officer were injured. Police destroyed explosive belts the men had been wearing, though they turned out to be fake.
Shortly before midnight on Wednesday, the day before the van plowed into the tree-lined walkway of Barcelona's Las Ramblas avenue, one person was killed in an explosion in a house in a separate town southwest of Barcelona, police said.
Police said they had arrested a Moroccan and a man from Spain's north African enclave of Melilla, though neither was the van driver. He was seen escaping on foot and was still at large. A third man was arrested in the town of Ripoll on Friday.
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.
Later on Friday, residents and tourists returned to Barcelona's famous Las Ramblas promenade where hours earlier a white van had zigzagged at high speed through pedestrians and cyclists, leaving bodies and injured writhing in pain in its wake.
As Spain went into three days of mourning, people laid flowers and lit candles in memory of the victims along the promenade. Prime Minister Mariano Rajoy and Spain's king Felipe visited Barcelona's main square nearby to observe a minute's silence.
"Those that live here can't believe it, because we live here, we walk here, this is our neighborhood," Sebastiano Palumbo, 47, an Italian architect working in Barcelona, said as he walked his dog. "I think the best thing would be to continue, every day, doing what do."
The injured and dead came from 24 different countries, the Catalan regional government said, ranging from France and Germany to Pakistan and the Philippines. Spanish media said several children were killed.
(For a graphic on Barcelona crash, click http://tmsnrt.rs/2fOJ9Sm)
ISLAMIC STATE CLAIM
Islamic State's Amaq news agency said the attackers had carried out the operation "in response to calls for targeting coalition states" - a reference to a U.S.-led coalition against the Sunni militant group. Spain has several hundred soldiers in Iraq training local forces in the fight against Islamic State.
There was no immediate indication though that Islamic State had directed or organized the attack, although some of those responsible for similar attacks in Europe have been inspired by the jihadist group.
Islamist militants have staged a string of attacks across Europe in the past 13 months, killing well over 100 people in Nice, Berlin, London and Stockholm.
The Barcelona attack was the deadliest in Spain since March 2004, when Islamist militants placed bombs on commuter trains in Madrid, killing 191 people and wounding more than 1,800.
BODIES ON THE GROUND
Police said the two men detained on Thursday had been arrested in two towns, Ripoll and Alcanar, both in the region of Catalonia, of which Barcelona is the capital.
The explosion was also in the town of Alcanar. One person died and another was injured in that incident, police said.
A man was also found dead in a car which had driven into a police checkpoint in Barcelona, though the police could not immediately confirm it was connected with the van attack.
Earlier, mobile phone footage showed bodies strewn along Las Ramblas, some motionless. Paramedics and bystanders bent over them, treating them and trying to comfort those still conscious.
German Chancellor Angela Merkel, speaking after media reports that some Germans were among those killed, said Islamist terrorism "can never defeat us" and vowed to press ahead with campaigning for a general election in Germany in September.
Last December, Berlin suffered a similar attack when a truck plowed into a crowded Christmas market, killing 12.
Italy's foreign ministry said two of its nationals were killed and three injured. German television channel ZDF reported that three Germans were among the dead, as was a Belgian according to Belgium's foreign minister.
France said 26 of its citizens were hurt, and 11 of them were in a serious condition. Australia said at least four of its nationals were injured, with broadcaster ABC saying a seven-year-old boy was unaccounted for.
FOREIGN CONDEMNATION, SYMPATHY
The incident took place at the height of the tourist season in Barcelona, which is one of Europe's top travel destinations with at least 11 million visitors a year.
Foreign leaders voiced condemnation and sympathy, including French President Emmanuel Macron, whose nation has suffered some of Europe's deadliest militant attacks in recent years.
However, Polish Interior Minister Mariusz Blaszczak said the attack showed the European Union's system of migrant relocation was wrong. "It is dangerous. Europe should wake up," he said. "We are dealing here with a clash of civilizations."
Authorities in Vic, a small town outside Barcelona, said a van had been found there in connection with the attack. Spanish media had said that a second van was hired as a getaway vehicle.
Barcelona is the capital of the wealthy northeastern region of Catalonia, which plans to hold a popular vote on Oct. 1 on whether it should secede from Spain. The central government says the vote cannot go ahead because it is unconstitutional.
(Additional reporting by Sarah White, Andres Gonzalez, Silvio Castellanos, Alissa de Carbonnel, Ali Abdelaty and Ahmed Aboulenein; Writing by Mark Trevelyan; Editing by Mark Bendeich, Nick Tattersall and Richard Balmforth)