Complex sentence: The town's resistance (rivalled only by the defenders of Zaragoza) served Spanish purposes well owing to the large delays and losses imposed on the French, and the battle became something of a legend over the course of the Peninsular War.
Split into simpler sentences: The town's resistance served Spanish purposes, owing to the large delays and losses imposed on the French. The battle became something of a legend over the course of the Peninsular War.