The castle is situated in the high part of the town. Its origins are in the 11th century, although the remains preserved are from the 12th century. It is divided into two parts - one of them was intended as a local cemetery and the other for the defence of the population. It was first a Muslim settlement, then it came to form part of the Crown of Aragon. Most of the existing remains date from this time, the period of Pedro IV. It is not very well preserved, as most of the castle was destroyed by two earthquakes. This fortress has the unusual feature of housing the whole town - all of it formed part of the castle, surrounded by mountains. In 1993 the castle was bought from the Marquises of the town and was declared a Historic-Artistic monument. In the walled part, the parish church, the Orduña House, today a museum, and the prison are outstanding.