The fortified city of Castra (today’s Ajdovščina) can be mentioned within the claustra Alpium Iuliarum barrier system due to its exceptional position. It stood approximately in the middle of the Vipava Valley (Vipavska dolina), in front the beginning of the ascent to the alpine passes, thus being the extreme western point of the so-called Illyro-Italian Gate.
It was first recorded in ancient sources in the second half of the 3rd century as a relay station (mutatio Castra) and it used to thrive until the first decades of the 5th century or even the early Middle Ages (6–8th centuries).
The ancient city of Castra was surrounded by a strong wall with 14 towers, about 30 m apart from each other. The course of the wall, measuring about 583 m, can also be traced in the modern cadastral map. In the north, its wedge-like shape was probably used to facilitate the flow of water from the Lokavšček Stream when the waters were high. On the western side, an ancient western two-phase burial ground was discovered.
After the descent from the impenetrable forests of Hrušica, Castra was the first city where the terrain opened towards the plains of the north-eastern Italy. Due to its proximity, archaeologists believe that the city offered a good logistical hinterland to the barrier lines on Hrušica, which is why it can be mentioned in connection to the claustra Alpium Iuliarum barrier system. Based on its hinterland position and most likely also the role in the CAI system, the fortified city of Castra can be compared with the ancient Rijeka (Tarsatica) in Croatia, since the fortification of both cities took place at the same time.