Crowned King in Germany, Charles sided with Pope Leo X and declared Martin Luther an outlaw at the Diet of Worms (1521). The same year, Francis I of France, surrounded by the Habsburg possessions, started a conflict in Lombardy that lasted until the Battle of Pavia (1525), which led to the French king's temporary imprisonment. The Protestant affair re-emerged in 1527 as Rome was sacked by an army of Charles's mutinous soldiers, largely of Lutheran faith. After his forces left the Papal States, Charles V defended Vienna from the Turks and obtained the coronation as King in Italy by Pope Clement VII. In 1535, he annexed the vacant Duchy of Milan and captured Tunis. Nevertheless, the loss of Buda during the struggle for Hungary and the Algiers expedition in the early 1540s frustrated his anti-Ottoman policies. Meanwhile, Charles V had come to an agreement with Pope Paul III for the organisation of the Council of Trent (1545). The refusal of the Lutheran Schmalkaldic League to recognize the council's validity led to a war, won by Charles V with the imprisonment of the Protestant princes. However, Henry II of France offered new support to the Lutheran cause and strengthened a close alliance with the sultan Suleiman the Magnificent, the ruler of the Ottoman Empire since 1520.