Probably of Celtic origin, Milan was conquered by Rome in 222 B.C. In later Roman times it was the capital (A.D. 305–402) of the Western Empire and the religious center of N Italy. In 313 Constantine I issued the Edict of Milan, which granted religious toleration. From 374 to 379 the city's bishop was St. Ambrose, known for the liturgy he wrote and for his eloquence. Milan was severely damaged by the Huns (c.450) and again by the Goths (539) and was conquered by the Lombards in 569.
In the 12th cent. it became a free commune and gradually gained supremacy over the cities of Lombardy. From the 11th to the 13th cent. Milan suffered from internal warfare between rich and poor, from the Guelph and Ghibelline strife, and from the enmity of rival cities, which assisted Emperor Frederick I in destroying it (1163). As a member of the Lombard League, Milan later contributed to the defeat of Frederick I at Legnano (1176). The city's independence was recognized in the Peace of Constance (1183). In the 13th cent. Milan lost its republican liberties; first the Torriani, then the Visconti (1277) became its lords. Galeazzo Visconti received (1395) the title of duke of Milan from the emperor, and under him the duchy became one of the most important states in Italy. After the death of the last Visconti (1447) the Sforza became dukes of Milan. The city flourished until it became involved in the Italian Wars and passed under Spanish domination (1535).
At the end of the War of the Spanish Succession, Austrian rule of Milan was established (1713–96). Napoleon I made the city the capital of the Cisalpine Republic (1797) and of the kingdom of Italy (1805–14). In 1815 Milan again came under Austria. It was a leading center throughout the Risorgimento; after five days of heroic fighting in 1848 the citizens of Milan succeeded in expelling the Austrians, who returned, however, a few months later. In 1859 the city was united with the kingdom of Sardinia. Its industrial importance grew after it was incorporated (1861) into Italy. In World War II Milan suffered widespread damage from Allied air raids; many significant buildings were damaged beyond repair.