A woman holds a sign at Placa de Catalunya in Barcelona. (Susana Vera/Reuters)

THE TERRORIST attacks in Spain’s Catalonia region superficially resembled the car assaults that have murdered random pedestrians in Nice, Berlin, London and Stockholm in the past 13 months. Yet this plot was on another scale. Rather than a solo operation, the attacks in Barcelona and the seaside resort of Cambrils were carried out by a cell of at least eight to as many as 12 people, authorities said. Fourteen people died, along with five of the attackers, and 126 were injured — but the carnage could easily have been worse. Police now believe that a house that was destroyed in an explosion before the attacks contained propane canisters the terrorists intended to use in the attacks. And the quick response by officers in Cambrils likely saved many lives.

Investigators still had much to learn Friday about the participants in the attack and where they came from. Several were reported to be Moroccan nationals, while another was from Melilla, a Spanish exclave adjacent to Morocco. But the Islamic State’s claim of credit seemed plausible. It suggested that even as their self-styled “caliphate” in Iraq and Syria crumbles, the jihadists still have the capacity to sponsor sophisticated attacks deep inside the West.

The assaults have failed to intimidate governments and citizens elsewhere in Europe, and so far Spain — which withdrew its forces from Iraq not long after another major terrorist attack in 2004 — appears to be no exception. Thousands of people gathered Friday in the iconic Las Ramblas district in Barcelona, where a van had wreaked havoc Thursday afternoon, to chant “I am not afraid” in Catalan. Despite deep differences between the province’s leaders, who aspire to make Catalonia an independent state, and the central government in Madrid, the local government was reported to be collaborating closely with Prime Minister Mariano Rajoy, who quickly traveled to Barcelona. Journalists reported that vacationers in bathing suits were back on the beach in Cambrils just hours after the second attack early Friday morning.

If there doesn’t seem to be a danger of capitulation to the terrorists, there is nevertheless a risk the Islamic State will achieve one of its major aims: isolating Muslim communities in the West and fomenting prejudice or even violence against them. In that sense, the extremists have an ally in President Trump, who responded to the Catalonia attacks with a tweet that simultaneously slandered one of America’s most renowned generals and suggested that the appropriate response to “Radical Islamic Terror” was war crimes. Mr. Trump cited a false story he has previously told about Gen. John J. Pershing, who the president said ordered the massacre of Muslim insurgents in the Philippines in the early 20th century with bullets dipped in pig blood.

Nothing of the kind occurred. But if attacks like those in Spain lead to lawless violence by U.S. or European forces or crude insults to Muslim communities, not just the Islamic State will be to blame.