For centuries the Milanese considered the castle to be an emblem of both tyranny and foreign domination and accordingly attempted to assault and demolish the reviled fortress on various occasions. Only after the unification of Italy and its conversion to a cultural centre did the castle truly become dear to the hearts of the Milanese and as such, a symbol of the city.
The original construction was ordered by local lord Galeazzo II Visconti in 1358–c. 1370; this castle was known as Castello di Porta Giova (or Porta Zubia), from the name of a gate in walls located nearby. His successors Gian Galeazzo, Giovanni Maria and Filippo Maria Visconti enlarged it, until it became a square-plan castle with 200 m-long sides, four towers at the corners and up to 7-metre-thick (23 ft) walls. The castle was the main residence in the city of its Visconti lords, and was destroyed by the short-lived Golden Ambrosian Republic which ousted them in 1447.
In 1450, Francesco Sforza, once he shattered the republicans, began reconstruction of the castle to turn it into his princely residence. In 1452 he hired sculptor and architect Filarete to design and decorate the central tower, which is still known as Torre del Filarete. After Francesco's death, the construction was continued by his son Galeazzo Maria, under architect Benedetto Ferrini. The decoration was executed by local painters. In 1476, during the regency of Bona of Savoy, the tower with her name was built.
The castle in the 16th century.
In 1494 Ludovico Sforza became lord of Milan, and called numerous artists to decorate the castle. These include Leonardo da Vinci (who frescoed several rooms, in collaboration with Bernardino Zenale and Bernardino Butinone) and Bramante, who painted frescoes in the Sala del Tesoro; the Sala della Balla was decorated with Francesco Sforza's deeds. Around 1498, Leonardo worked at the ceiling of the Sala delle Asse, painting decorations of vegetable motifs. In the following years, however, the castle was damaged by assaults from Italian, French and German troops; a bastion, known as tenaglia was added, perhaps designed by Cesare Cesariano. After the French victory in the 1515 Battle of Marignano, the defeated Maximilian Sforza, his Swiss mercenaries, and the cardinal-bishop of Sion retreated into the castle. However, King Francis I of France followed them into Milan, and his sappers placed mines under the castle's foundations, whereupon the defenders capitulated. In 1521, in a period in which it was used as a weapons depot, the Torre del Filarete exploded. When Francesco II Sforza returned briefly to power in Milan, he had the fortress restored and enlarged, and a part of it adapted as residence for his wife, Christina of Denmark.
Coat of arms of Galeazzo Maria Sforza, painted on an interior ceiling.
Under the Spanish domination which followed, the castle became a citadel, as the governor's seat was moved to the Ducal Palace (1535). Its garrison varied from 1,000 to 3,000 men, led by a Spanish castellan. In 1550 works began to adapt the castle to modern fortification style, as a hexagonal (originally pentagonal) star fort, following the addition of 12 bastions. The external fortifications reached 3 km in length and covered an area of 25.9 hectares. The castle remained in use as a fort also after the Spaniards were replaced by the Austrians in Lombardy.
Journal of Jean-Claude Locquin describing the trenches made around the castle during the Napoleonic rule. Archives nationales de France.
Most of the outer fortifications were demolished during the period of Napoleonic rule in Milan under the Cisalpine Republic. The semi-circular Piazza Castello was constructed around the city side of the castle, surrounded by a radial street layout of new urban blocks bounded by the Foro Buonoparte. The area on the "country" side of the castle was laid out as a 700-by-700-metre (2,300 by 2,300 ft) square parade ground known as Piazza d'Armi.
After the unification of Italy in the 19th century, the castle was transferred from military use to the city of Milan. Parco Sempione, one of the largest parks in the city, was created on the former parade grounds.
The government of Milan undertook restoration works, directed by Luca Beltrami. The Via Dante was cut through the medieval street layout in the 1880s to provide a direct promenade between the castle and the Duomo on axis with the main gate. The central tower, known as the Torre Filarete, above the main city entrance was rebuilt, on the basis of 16th-century drawings, between 1900 and 1905 as a monument to King Umberto I.
Allied bombardment of Milan in 1943 during World War II severely damaged the castle. The post-war reconstruction of the building for museum purposes was undertaken by the BBPR architectural partnership.