The structure was built in the 12th century by William I, the son of Roger II of Sicily, the first monarch of the Kingdom of Naples. With the succession of the Angevins in 1266, Naples was the capital of a great kingdom, and there are records of a further increase in the population: in 1278 there were nearly 30,000 inhabitants. Under Charles I (reigned 1266-1285) Castel Capuano was restored, and the southern stretch of city walls was enlarged. All of the city’s various legal offices and departments were consolidated here and it became the Hall of Justice - known as the “Vicaria” - the basements of which served as a prison. Over the entrance to the castle is the crest of Emperor Charles V, who visited Naples in 1535.