The 9th century was the period of episcopal supremacy, and in the 11th the city formed part of the vast possessions of Bonifacio III, marquis of Canossa. From him it passed to Geoffrey, duke of Lorraine, and afterwards to the countess Matilda, whose support of the pope led to the conquest of Mantua by the emperorHenry IV in 1090. Reduced to obedience by Matilda in 1113, the city obtained its liberty on her death, and instituted a communal government of its own, salva imperiali justitia. It afterwards joined the Lombard League; and the unsuccessful attack made by Frederick II in 1236 brought it a confirmation of its privileges. But after a period of internal discord Ludovico Gonzaga attained to power (1328), and was recognized as imperial vicar (1329); and from that time till the death of Ferdinando Carlo in 1708 the Gonzagas were masters of Mantua under Gian Francesco II, the first Margrave, Ludovico III, Gian Francesco II (whose wife was Isabella d'Este), and Federico II, the first duke of Mantua, the city rose rapidly into importance as a seat of industry and culture. It was stormed and sacked by the Austrians in 1630, and never quite recovered.