the castle sustained serious damages during the third carlist war