BARCELONA, Spain — When an earthshaking explosion on Wednesday blew apart a house outside Alcanar, a town surrounded by olive groves and holiday homes overlooking the Mediterranean, the police first blamed it on a gas leak.

“Nothing ever happens here,” Mayor Alfons Monserrat said.

The Spanish police now believe that tiny Alcanar may have been the incubator for a conspiracy far more ambitious than even the van attacks in Catalonia that killed 14 people and injured more than 80. All but one of the casualties occurred Thursday afternoon on the Ramblas, Barcelona’s colorful central thoroughfare. It was Spain’s worst terrorist attack in more than a decade, and the Islamic State has claimed responsibility.

The Alcanar blast, they suspect, was a mistake by the plotters, who had intended to make a powerful bomb, place it in a van and detonate it in the crowded center of Barcelona. That plan disintegrated along with at least 12 butane gas canisters that were discovered in the ruins of the house in Alcanar on Wednesday night.