The 2017 terror attacks in Spain were orchestrated by the National Intelligence Center (CNI), a former senior police officer said Thursday.

The aim was to destabilize Catalonia before an independence referendum but the outcome that left 16 dead, was a miscalculation, said Jose Manuel Villarejo, according to the Catalanews agency.

Quoting Villarejo’s testimony in court, the news outlet said the attacks, which included a truck plowing those pedestrians on Barcelona’s La Rambla, “were a serious mistake” on the part of former National Intelligence Center (CNI) Director Feliz Sanz Roldan.

Villarejo’s remarks have ignited outrage among portions of Catalan political parties, especially those in favor of the region’s independence.

Catalan President Pere Aragones demanded that the Spanish government again look into the attack and requested his administration’s legal team review the former officer’s remarks.

Parliament speaker Laura Borras also requested the region’s assembly legal team take the case to the public prosecutor.

On Aug. 17, 2017, a van driven by a member of an extremist terror cell crashed into pedestrians along the famous Las Ramblas, killing 13 people and injuring 120. A 14th victim died later from injuries.

The 22-year-old Moroccan driver murdered another person while escaping, and stole a car before leaving the area on foot.

Hours later, five members of the terror cell carried out a second attack 100 kilometers (62 miles) away in the coastal town of Cambrils, crashing into pedestrians and fatally stabbing a woman.

Six terrorists were shot dead by police in a vineyard near Barcelona a few days later and two other members died when a bomb workshop exploded.​​​​​​​