Milan. In 1500, Louis XII, having reached an agreement with Ferdinand II of Aragon to divide Naples, marched south from Milan. By 1502, combined French and Aragonese forces had seized control of the Kingdom; disagreements about the terms of the partition led to a war between Louis and Ferdinand. By 1503, Louis, having been defeated at the Battle of Cerignola and Battle of Garigliano, was forced to withdraw from Naples, which was left under the control of the Spanish viceroy, Ramón de Cardona. French forces under Gaston de Foix inflicted an overwhelming defeat on a Spanish army at the Battle of Ravenna in 1512, but Foix was killed during the battle, and the French were forced to withdraw from Italy by an invasion of Milan by the Swiss, who reinstated Maximilian Sforza to the ducal throne. The Holy League, left victorious, fell apart over the subject of dividing the spoils, and in 1513 Venice allied with France, agreeing to partition Lombardy between them. Louis mounted another invasion of Milan, but was defeated at the Battle of Novara, which was quickly followed by a series of Holy League victories at La Motta, Guinegate, and Flodden, in which the French, Venetian, and Scottish forces were decisively defeated. However, the death of Pope Julius left the League without effective leadership, and when Louis' successor, Francis I, defeated the Swiss at Marignano in 1515, the League collapsed, and by the treaties of Noyon and Brussels, surrendered to France and Venice the entirety of northern Italy. The elevation of Charles of Spain to Holy Roman Emperor, a position that Francis had desired, led to a collapse of relations between France and the Habsburgs. In 1519, a Spanish invasion of Navarre, nominally a French fief, provided Francis with a pretext for starting a general war; French forces flooded into Italy and began a campaign to drive Charles from Naples. The French were outmatched, however, by the fully developed Spanish tercio tactics, and suffered a series of crippling defeats at Bicocca and Sesia against Spanish troops under Fernando d'Avalos. With Milan itself threatened, Francis personally led a French army into Lombardy in 1525, only to be defeated and captured at the Battle of Pavia; imprisoned in Madrid, Francis was forced to agree to extensive concessions over his Italian territories in the "Treaty of Madrid" (1526). The inconclusive third war between Charles and Francis began with the death