Spain was seized Friday with the realization that it had incubated a large-scale terrorist plot, as authorities across Europe engaged in a manhunt following the deadliest attacks to strike the country in more than a decade: two vehicle assaults in Barcelona and a Catalan coastal town.
Investigators believe that at least eight people plotted the attacks, putting them at a level of sophistication comparable to major strikes in Paris and Brussels in recent years. Other more recent attacks in London, Berlin and the southern French city of Nice were perpetrated by individuals operating largely on their own.
Spanish counterterrorism officials were scrambling to untangle the terrorist network.
France announced it was reinforcing its frontier with Spain, a signal of the fears that further violence could spill beyond Spanish borders. Anti-immigrant Central European leaders condemned the migration histories of the suspects, all of whom were believed to be of Moroccan descent.
In a sign that the attack could have been significantly worse, police said that they believed the assailants were planning to use propane and butane canisters in an explosive assault against civilians. Instead, the gas ignited prematurely, destroying a house in Alcanar, about 100 miles southwest of Barcelona that was being used by the suspects. The explosion killed at least two people and injured 16, including police officers and firefighters investigating the site. Hours later, one of the suspects set out for the touristy Las Ramblas area of Barcelona in a white delivery van.
As of Friday evening, authorities had detained three Moroccan men and a Spaniard, but the fate of the main suspect - the driver of the van, who fled on foot after the rampage - was unclear. Police were investigating the possibility that he was among five assailants killed in the second attack early Friday.
Meanwhile, the nation began to mourn the international group of 13 victims who were fatally struck as they strolled in the heart of Barcelona's tourist district late Thursday afternoon. A 14th victim was killed in the second vehicle rampage in Cambrils, a seaside town about 70 miles southwest of Barcelona.
In Washington, the State Department said Friday that an American was among those killed. The department also said Spanish authorities still have not identified all of the casualties, so the U.S. Consulate in Barcelona is working with them to determine whether any more Americans were killed or injured.
ISIS claimed links to the Barcelona attack, but the level of involvement by the militant faction was unclear.
Spanish intelligence officials were circulating at least four names among their European counterparts on Friday, according to a Spanish intelligence official and a European intelligence official, both of whom spoke on condition of anonymity to discuss the situation.
The four men, all holding Moroccan citizenship, ranged in age from 18 to 24. Three were born in the North African country: Said Aallaa, 18; Younes Abouyaaqoub, 22; and Mohamed Hychami, 24. The fourth was identified in a Spanish police document as Moussa Oukabir, 17, but the European intelligence official said Spanish officials had flagged someone with the same family name but a different first name. All lived in or near the Catalan town of Ripoll, close to the French border.
At least three of the men were killed in the attack in Cambrils, the Spanish intelligence official said, without identifying which of the men were believed killed.
Two Spanish security officials said police originally sought Oukabir's older brother because his identity card was found in the truck used for the attack in Barcelona. The older brother, who is currently in custody, denies any connection to the attack and said his brother may have stolen his identity card, the official said.
"We cannot rule out further attacks," Maj. Josep Lluis Trapero, a Catalan police official, told reporters in Barcelona.
Authorities were not aware of any previous connection to extremism among the detained men, he said.
All five men involved in the second attack in Cambrils were shot dead after plowing their Audi into people along the corniche at about 1 a.m., Trapero said.
The nationality of the men was sure to raise alarm within European counterterrorism circles. Moroccan networks were also connected to major terrorist attacks in France and Belgium in recent years. Spain has a significant Moroccan population, and there has been a spike in arrivals of migrants from Morocco by sea this year.
Their background also prompted Europe's anti-migrant politicians to condemn what they said was a connection between migration and terrorism, even though there was no evidence that the men were part of the waves of migration from Africa and the Middle East in recent years.
"It is evident to everyone that there is a correlation between illegal immigration and terrorism," Hungarian Foreign Minister Peter Szijjarto told his country's MTI news agency. "Europe must protect itself, and the security of the people must be guaranteed."
In Barcelona, thousands of people gathered at midday Friday in a square at the top of Las Ramblas for a minute of silence, led by Spanish King Felipe VI and Prime Minister Mariano Rajoy. Afterward, they cheered, held single red roses to the sky and chanted in Catalan: "I am not afraid."
The whole Las Ramblas neighborhood was eerily quiet in the morning as heavily armed police patrolled on Friday.
Later in the day, tourists and onlookers filled the long boulevard, turning what is ordinarily a vacation hot spot into a site of mourning. Some set out candles to commemorate the victims.
In a series of tweets, President Donald Trump said U.S. agencies were "on alert" and blamed court challenges and opposition from Democrats for making security "very difficult." He gave no specifics.
"Radical Islamic Terrorism must be stopped by whatever means necessary!" Trump wrote. "The courts must give us back our protective rights. Have to be tough!"
The attacks on Thursday and Friday marked the latest uses of vehicles in terrorist strikes against civilians, following attacks since the middle of 2016 in Britain, France, Germany and Sweden.
Spain's civil protection agency said 120 people were injured in the attack in Barcelona, and an additional six in Cambrils. There were casualties among people of at least 34 nationalities, underscoring the international draw of the cosmopolitan Las Ramblas area, which has long stood at the heart of the city. France's Foreign Ministry said 26 of its citizens were injured, 11 of them seriously.
Residents of Barcelona said they had long feared an attack on their bustling city.
"This is a huge city, and somehow we were always expecting something like this, but of course you're never prepared," said Cristina Nadal, 44, an aide for the Catalan government, who came to the moment of silence on Friday.
The crowd was "exactly what we wanted to show - that although the terrorists want to beat us, we can show to the world that we can still stand strong," she said.
Two longtime Muslim residents of Barcelona said they were furious about the violence.
"What Islam teaches us is that killing one person is like killing all of humanity," said Nagma Jawed, 40, who moved to the city 20 years ago from her native India and runs a textile shop in the city.
"First of all, we are human beings. Our religion comes after that," said Jawed, who was wearing a headscarf on Friday as she stood in the square with her husband for the mourning ceremony.(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)