By the 17th century pirate attacks prompted the building of extensive city defenses colossal forts, a chain across the harbor mouth, and prominent city walls making Havana the Bulwark of the West Indies.
Pirate attacks against Havana spurred the building of colossal forts.
You can see a good view at the top of the citadel.