The Battle of Pavia (1525) marks a watershed in the city's fortunes, since by that time, the former cleavage between the supporters of the Pope and those of the Holy Roman Emperor had shifted to one between a French party (allied with the Pope) and a party supporting the Emperor and King of Spain Charles V. Thus during the Valois-Habsburg Italian Wars, Pavia was naturally on the Imperial (and Spanish) side. The defeat and capture of king Francis I of France during the battle ushered in a period of Spanish occupation which lasted until 1713. Pavia was then ruled by the Austrians until 1796, when it was occupied by the French army under Napoleon.