It was at the time of the Kingdom of Illiria, established by Napoleon between 1809 and 1813, that the interior of the Castle was renovated to house a large number of troops and supplies of food, weapons and munitions. The military purpose was maintained after the Habsburgs returned and it continued to be used as barracks. At the beginning of the 20
th
century the Castle was a garrison prison and seat of the Military Tribunal. In 1914 a station for courier pigeons was established there. As Ranieri Mario Cossar wrote in 1937, at the end of the war the Castle “looked like a fatally injured giant. The middle part was hit by four 305 mm shells […], it looked like it was about to collapse at any moment.” After 1934 the Castle was rebuilt reproducing as closely as possible 16th century architectural style. It was opened to the public on 7 th September 1937 in the presence of H.R.H. Duke Amedeo of Aosta.