Jaga, the Spanish Government, not the terrorists, lost and because they weren't objective. Their intelligence service blundered. Spain historically has commited blunders starting with England's defeat of the Spanish armada.
Franco won Spanish Civil War (1936) with the help of Moorish troops & German pilots because Spanish military was incompetent Then Franco established a socialist economy & taxed the Catholic Church heavily even though he previously promised that he wouldn't do that. Carl