The foundation of the Kingdom of Lombardy-Venetia following the fall of Napoleon, brought the Austrians back to Milan in 1815. The castle continued to serve as a barracks, while the empty square behind the castle, Piazza d'Armi, became the setting for military parades.
During the uprising of the Five Days of Milan (18th - 22nd March 1848) the castle functioned as a prison for Milanese arrested by the Austrians and housed the canons that Radetzky used to bombard the city. After the retreat of the Habsburg troops piles of bodies of both men and women were discovered in different parts of the castle. In the following four months of provisional Milanese government the round corner towers were lowered. In 1859, when the Austrian army definitively capitulated, the castle was sacked by the local population, who looted weapons, furnishings and money destined for the troops.