 It served as the town fortress and military overlook during times of attack through the centuries.Under the Aragonese domination, it was adorned with round towers and crenellations.Over the centuries it lost its original defense function, becoming a residence for the feudal lords.