On the night of 16 August 2017, an explosion destroyed a house in Alcanar, a town in Catalonia, Spain, killing two members of a terrorist cell as they handled explosives, including Abdelbaki Es Satty, an imam in the nearby town of Ripoll whom investigators identified as the group's chief organizer. More than 120 gas canisters were found at the property; investigators believe the group had intended to build one large bomb, or three smaller bombs to be placed in three rented vans, and detonated the explosives by accident while assembling them. The next afternoon, 17 August, a rented van was driven into pedestrians along a roughly 550-metre stretch of La Rambla, a pedestrian street in central Barcelona, killing 13 people at the scene and injuring more than 130. The driver escaped on foot, then fatally stabbed Pau Pérez in order to steal his car and flee the city. One of the people injured on La Rambla later died of their injuries, on 27 August, bringing that attack's death toll to 14.
About nine hours after the Barcelona attack, five men linked to the same cell drove a car into a crowd of pedestrians in the coastal town of Cambrils at around 1:00 am on 18 August, then attacked bystanders with knives while wearing fake suicide vests. The attack killed a 63-year-old Spanish woman and injured six others, including a Cuban tourist and a police officer. A police officer shot and killed four of the five attackers at the scene; the fifth died of his injuries hours later. Police continued searching for the driver of the La Rambla van in the days that followed, and on 21 August, officers shot and killed him near vineyards in Subirats, a town about 31 kilometres west of Barcelona, after a local resident reported a stranger in the area.
In total, 16 people were killed across the two attacks, not counting eight attackers who also died; eleven of the sixteen were foreign nationals, and ten of those were tourists. More than 130 people were injured. Spain's prime minister, Mariano Rajoy, described the Barcelona attack as jihadist, and the Islamic State-linked Amaq News Agency claimed indirect responsibility for the cell. Chief Josep Lluís Trapero of the Mossos d'Esquadra, the Catalan police force, said investigators were working on the theory that the Cambrils attack and the Alcanar explosion were connected to the Barcelona attack. Police arrested four additional men in the days after the attacks; two were released within about a week on conditions that included surrendering their passports.
In May 2021, Spain's National Audience court convicted three men of offenses connected to the plot. Mohamed Houli Chemlal, who survived the Alcanar explosion, and Driss Oukabir, whose identity document was used to rent the van for the La Rambla attack and who told police it had been stolen, were both convicted of belonging to a terrorist organization and of murder, and sentenced to more than 53 and 46 years in prison respectively; both were acquitted of terrorist-homicide charges. A third man, Said Ben Iazza, was convicted of collaborating with the cell and sentenced to eight years in prison. In January 2022, former police commissioner José Manuel Villarejo told Spain's High Court that the country's intelligence service had known of the plot in advance, prompting the Catalan government to call for an investigation; the claim has been widely characterized as an unsubstantiated conspiracy theory.