The remains of the Àger castle (cat. El castell d’Àger), along with the monastery of Sant Pere, are located on top of a hill that dominates the town. The neighborhoods of Sant Pere, Sant Martí, Solsdevila and the Pedró Street, that are staggered under the castle, were inside the walled enclosure. Outside the walls were the suburbs of Sant Martí and Pedró.

The valley and the castle of Àger were conquered by Arnau Mir de Tost in the first half of the 11th century. The documentation refers to the fortress and its lands. From 1034 the castle was under the control of Arnau Mir de Tost. In 1046 it was conquered by the Muslims, and in 1048 it was reconquered definitively by Arnau Mir. In a donation of certain allods by Arnau Mir to Ollemar and Xeno in 1038 it is mentioned that the allods are ‘in kastrum de Ager’, and the castle terrain disputes are clarified: ‘de parte orientis in Nogera, de meridie in sera de Nor, de occiduo in Nogerola, a parte vero circii in sera de Ares’. These disputes were present in the area of the valley and confirmed in 1042 by the sale of allods granted to Exabel and Garoca and in others documents from 1060 and 1068.

There is no physical or documentary evidence of a Roman origin of the castle, but an Islamic origin may be considered. The chronicle of ‘al-‘Udhrï’ mentions the fortification of several fortresses among which ‘Ayira’. The castle of Àger would have been fortified from the first moments of the organization of the Frontera Superior in caliphate times. Considering its privileged location and the magnificent construction, Arnau Mir de Tost converted the fortress into his preferred political and residential center, and saw its jurisdictional rights, as well as, an almost absolute autonomy in this border area recognised by the County.

In 1061 the ‘camera’ or noble hall was mentioned, an essential element of a residential castle at the time. In 1068, Arnau Mir de Tost and his wife Arsenda gave the castle to the abbey of Sant Pere d’Àger, which became its owner and its abbot the allodial lord. The castle, however, remained in the hands of the Cabrera the viscounts of Àger, and later counts of Urgell, descendants of Arnau Mir de Tost, who acted as feudatarios of Sant Pere d’Àger, a situation that lead to numerous conflicts through centuries.

During the Reapers War (1640-1652), Àger fought against the King of Spain, Philip IV. In 1644, the castle was conquered by the king’s troops, but only after a vigorous defense and when they had been under siege for so long that no food was left. They rebelled the following year, but in October 1646, the town of Àger returned under Spanish dominion, as the castle of Àger was conquered. It was liberated again but in 1652 it was again taken by force, this time definitively.

The preserved remains are scarce if we take into account the importance this construction had, located within the sovereign enclosure of the walls of Àger, next to the monastery. The essential element of the castle had to be the large hall, or the residential palace of the viscounts. Of the castle it remains a part of the ground floor of a large rectangular building with two parallel nave layout, situated lower than the ground floor of the church. Above these naves there probably was the main hall of the castle-palace, as we find in other castles of the time, such as the Llordà castle, built perhaps a little earlier also by Arnau Mir de Tost. The naves have a width of about 3 m and a length of more than 16 m. The height reaches more than 5 m. Most likely they were covered with a barrel vault. To the east of the naves, we find the defense wall.

The body is made of rectangular ashlars of medium size (15 cm x 30 cm). It can be dated to the middle of 11th century.

To understand this construction it is necessary to relate it to the walls of the enclosure, that protected the summit of the hill, and within it the religious constructions. The bell towers and the apses could have had an important defensive role. The expansion of the cloister was determined by the castle and the space it occupied. Hence, there are vestiges of possible constructions related to the fortress that are very close to the buildings of the cloister, perhaps even older than the remains of the palace.

Recently, the base of a watchtower built by Arnau Mir de Tost has been discovered. This tower was an essential element of the defense of the Àger Valley, as it was communicated with other towers, such as those of Claramunt, Fontdepou, Torre de Sanuy, Torre del Negro, etc. It had a diameter of about 18 m, and a 2 m thick wall, it is estimated to have been more than 20 m high, and considered one of the largest military towers in Catalonia. Both the Viscount Palace and the large watchtower date back to the 11th century, when the construction of the complex began on the remains of an older wall that surrounded the entire sovereign enclosure, possibly of Muslim origin (9th century).