 In the 17th and 18th centuries, the castle became an arsenal.In 1797 the town of Ljubljana and the castle were occupied for the first time by the French army, and again in 1809.In the period of the Illyrian Provinces, the castle was used as barracks and a military hospital.