Reign of Frederick II
 Post-Frederick II 
 The Battle of Desio was fought on 21 January 1277 between the Della Torre and Visconti families for the control of Milan and its countryside. The battlefield is located near the modern Desio, a commune outside the city in Lombardy, Northern Italy.
 Although generally considered one of the numerous minor battles fought in the 13th century in Italy during the Wars of the Guelphs and Ghibellines, it was in fact the conclusion of a long inner struggle for the possession of Milan, leading to the transformation of the former democratic regime into an aristocratic signoria. The Visconti victory granted them the rule over Milan, which lasted until the 15th century.
 In the 13th century, the politic life in Milan shared the same path of many other communes in Italy, living an increasing series of inner divisions and episodes of corruption. In the decades preceding the battle, the noble family of the Della Torre (or Torriani) had gained the most important political charges in the commune, this way nullifying the democratic ideals of the original medieval commune. They had also launched a program of public works and military expansions, which however brought the Milanese treasure to collapse; the use of often reckless mercenary units further exacerbated the population, granting an increasing support for the Della Torre traditional enemies, the Visconti.
 On 22 July 1262 Ottone Visconti was created archbishop of Milan by Pope Urban IV, against the Della Torre candidate, Raimondo della Torre, bishop of Como. The latter thus started to publicize an alleged Visconti's nearness to the heretical Cathars and charged them of high treason: the Visconti, who accused the Della Torre of the same crimes, were then banned from Milan and their properties confiscated. The civil war which ensued caused more damage to Milan's population and economy, lasting for more than a decade.
 The Milanese had destroyed most of the fortifications in the towns of Brianza north of the city, fearing they could be used as strongpoints by the rebels and their northern ally, Como. They had however spared those of Desio, some 30 km north of Milan, as there converged three important trade routes from Como, Erba, and Lecco.
 On 20 January, 500 Milanese heavy cavalry moved to occupy Desio, where they would be joined by another 500 heavy cavalry which had just pushed back a rebel attack at Civate, and by some 400 infantry. Likely, their strategy was to attack Visconti's vanguard army, which amounted to some 1,200 men (mostly infantry and archers), easily defeating it. Next step was the destruction of the rebel base of Como.
 However, during the inhabitants of Desio abandoned the now hated Milanese government. Visconti (whom, according to tradition, was warned of the occasion; while others state that the Visconti attack pushed the populace to rebellion) rushed to the town before the Milanese reinforcements could arrive.
Whether Visconti had foreknowledge, or the villagers rebelled, the fact is that at dawn on 21 January 1277 the surprise attack against the government forces succeeded and the village of Desio was captured. The gates were opened, and the rebels defeated the Milanese army: Francesco della Torre was killed, while his brother Napo, lord of Milan, was jailed in the Castel Baradello at Como, where he died the following year. Despite the minor size of the battle, Napo's capture was a fatal blow for the della Torre's party. The Visconti easily seized Milan and put their supporters in the most important positions, gradually strengthening their power, which lasted until the mid-15th century.