At Roman era, the old Collioure, Caucoliberis, owned its own fortress, besieged by Visigoths in 673. In the 12th century, it belonged to counts of Roussillon, then Collioure fell to the king of Aragon.
In 1276, king Jacques I of Aragon's son, Jacques II, owned it. He reinforced the wall from 1280. 20 years later, it became kings of Majorque's residence: they extended the fortress, adding a vast building with 2 floors. Later, they added a big wall with machicolations and flanked by square towers. Meanwhile, the city was itself surrounded by its own wall!
In the beginning of the 15th century, the Roussillon became a Spanish province. And despite the powerful towers, the high wall, the bastion, the fortress was besieged by France in 1642. Phew! 17 years later, treaty of Pyrenees annexed Roussillon to France. What happened to Collioure, next? Well, they relaid out the city and the castle, which completely lose its strategical and defensive function...