In the Catalan Revolt of 1640-59, the town remained loyal to the king of Castile, which led to occupation of the city by Catalan troops. A similar event occurred during the Peninsular War. Later, during the First Carlist War, there was a siege of the city. The city was captured and looted by Carlist troops who held a strong position in the town for a time.
