The Florentines had thrown off Medici rule and established a republic after the Sack of Rome in 1527; the Florentine Republic had continued to participate in the war on the side of the French. The French defeats at Naples in 1528 and Landriano in 1529, however, led to Francis I of France concluding the Treaty of Cambrai with the Holy Roman Emperor Charles V. When Pope Clement VII and the Republic of Venice also concluded treaties with the Emperor, Florence was left to fight alone. Charles, attempting to gain Clement's favor, ordered his armies to seize Florence and return the Medici to power.