The driver of a van plowed into a crowd enjoying a peaceful, sunny afternoon on a pedestrianized stretch of Barcelona’s most famous street on Thursday, killing at least 12 people and leaving 80 others lying bloodied on the pavement amid wrecked kiosks, in what Spanish authorities said was a terrorist attack. Two men have been arrested.
Within hours, the Islamic State claimed that the perpetrators were its “soldiers,” adding Spain to the list of European countries — including France and Britain — where vehicles have been used in attacks on civilians.
Until Thursday, Spain had been spared from the recent wave of terrorist attacks in Europe — many involving vehicles plowing into crowds — claimed by extremists in France, Germany, Britain and elsewhere.
That changed in an instant, with witnesses describing people screaming and running for their lives as the driver of the van weaved back and forth just before 6 p.m., apparently trying to hit as many people as he could. Police officers swept through the area near Las Ramblas, a wide boulevard with a large pedestrianized section, telling people to get out of the area.
“I heard a crowd screaming,” Tom Markwell, a tourist from New Orleans, told the BBC. “It sounded like they were screaming for a movie star.”
The police were requesting that people not pass through the area near Plaza de Cataluña and Las Ramblas in the heart of the city, popular destinations for tourists.
The Barcelona police said they had put in place their protocols for dealing with serious attacks, the Catalan emergency services said that they had asked the authorities to close metro and train stations in the area.
“There has just been a massive trampling on the Ramblas in Barcelona by a person with a van,” the Catalan police said on Twitter.
Keith Fleming, an American who lives just off Las Ramblas, told The Associated Press that he was watching television when he heard a noise, looked out over his balcony and “saw women and children just running and they looked terrified.”
Mr. Fleming said that the street was deserted, with the exception of police officers with guns drawn or in riot gear. “It’s just kind of a tense situation,” The A.P. reported him as saying. “Clearly people were scared.”
Facebook activated its safety-check feature for Barcelona, taxis were reportedly giving free rides to help people get out of the city center, and public transit was free in the areas where it was still operating.
American counterterrorism officials in Washington said they were in contact with Spanish authorities to offer any assistance, but underscored that the investigation had just started.
President Trump said on Twitter that the United States condemned the attack and would “do whatever is necessary to help, telling Spaniards to “Be tough & strong, we love you!”
In a subsequent Tweet, Mr. Trump seemed to blame Islamist militants for the attack, citing what is widely believed to be a fictitious account of a military event, and even though the Spanish government had not identified any individuals or groups who might have been behind the attack.
Pro-Islamic State accounts on the Telegram messaging service shared news of the attack. One channel, called “Expansion of the Caliphate,” posted video of the scene of the violence alongside a message in Arabic. “Terror is filling the hearts of the Crusader in the Land of Andalusia,” it said.
In the past year, the Islamic State has devoted resources to translating their channels and messages into Spanish.
Although countries like France and Britain have repeatedly been named in Islamic State propaganda urging followers to plan and stage attacks, Spain has been less in the cross hairs.
The country has, however, been a transit point for recruits of the militant group, both for those going to Syria and those returning. The Spanish police arrested nine people in April who they said may have been connected with deadly attacks in France and Spain.
The attack appeared to follow the playbook of recent assaults in which attackers drove vehicles into crowded stretches of large European cities.
“While it’s not clear whether the attackers corresponded with ISIS prior to the operation, it’s clear that the methods used in the attack is something ISIS encouraged and incited over and again,” said Laith Alkhouri, a director in New York of the business-risk intelligence company Flashpoint, which tracks militant threats and cyberthreats.
In the French resort city of Nice, a man drove a rental truck into a crowd celebrating Bastille Day on the seaside Promenade des Anglais last year, killing 86 people.
A few days before Christmas last year, a driver in a stolen van mowed down unsuspecting shoppers at a holiday market in Berlin, killing 12 people and wounding dozens.
At least seven civilians were killed and dozens injured in June when knife-wielding assailants sped across London Bridge in a white van, ramming numerous pedestrians before emerging with large hunting knives to attack the capital’s Borough Market, a crowded nightspot.
The Islamic State claimed responsibility, saying the attack had been carried out by “a detachment of Islamic State fighters.”
That attack was reminiscent of another, on Westminster Bridge in London on March 22, when Khalid Masood, 52, drove a car into pedestrians, killing four people.
He then stabbed a police officer to death near Parliament before himself being shot and killed. The police treated that attack, in which 50 were injured, as “Islamist-related terrorism.”
There have been other deadly attacks using vehicles that were not related to Islamist extremists. A British man rammed a rental van into a congregation of Muslims leaving prayers in North London during Ramadan, and a man who was part of white supremacist demonstrations in Charlottesville, Va., drove his car into a crowd on Saturday, killing a woman.
In March 2004, a series of bombs ripped through commuter trains in Madrid, killing 191 people and wounding more than 1,800. The bombings were carried out by a group of North African Islamists that intersected with a band of petty criminals.
The leaders of European countries and cities whose countries have suffered attacks quickly expressed their support and solidarity with Barcelona.
In Germany, which is on alert for remains wary of potential terrorist threats weeks before the general election on Sept. 24, members of Chancellor Angela Merkel’s cabinet expressed their solidarity with the Spanish people, following the news from Barcelona.
“I am deeply shaken by the terrible news from Barcelona,” said Thomas de Maizière, the country’s interior minister. “Once again, terror has shown its grotesque face.”
Anne Hidalgo, the mayor of Paris, said on Twitter that Barcelona and Paris “are cities of sharing, love and tolerance. Such values are stronger than this despicable and cowardly terrorism. Sadiq Khan, the mayor of London, said his city “stands with Barcelona against the evil of terrorism.”
Reporting was contributed by Eric Schmitt, Yonette Joseph, Raphael Minder and Mark Walsh.