Gormaz was the largest fortress in Europe after its expansion in 956 AD. It is without a doubt the greatest example of military architecture, not only in Soria but in the entire Spanish territory. The original castle was built shortly after 756 AD by emir Abd ar-Rahman I of Córdoba, as part of a state ('dawla') policy to control rich landowners and peasants, as well as to try to govern and protect the Central Marches in the Douro Valley against the Christians to the North. In 965, Caliph al-Hakem II rebuilt and expanded the castle, as attested by an inscription over one of the gates.
The castle is more than 390 metres long though only 10-40 metres wide, has 28 towers, a main gate with a monumental horseshoe arch with remains of painted red and white voussoirs, two posterns, one of which with a small horseshoe arch, three mihrabs corresponding to a 'musalla' or open air collective oratory, use of 'spoliae' of the Roman period, and the remains of a water pool near the monumental gate mentioned before. It was repaired in the 14th century, from which time date the remains of two gates on the southern side.
References:Celje Castle was once the largest fortification on Slovenian territory. The first fortified building on the site (a Romanesque palace) was built in the first half of the 13th century by the Counts of Heunburg from Carinthia on the stony outcrop on the western side of the ridge where the castle stands. It had five sides, or four plus the southern side, which was a natural defence. The first written records of the castle date back to between 1125 and 1137; it was probably built by Count Gunter. In the western section of the castle, there was a building with several floors. Remains of the walls of this palatium have survived. In the eastern section, there was an enclosed courtyard with large water reservoirs. The eastern wall, which protects the castle from its most exposed side, was around three metres thicker than the rest of the curtain wall. The wall was topped with a parapet and protected walkway.