The castle is perched high on a rock above the town.