Karviná and Frýdek to his son and heir Frederick Casimir. Nevertheless, Frederick died already in 1571 and his father, struggling with financial problems, had to sell Bielsko as a state country to the Princes of Pless. The remaining duchy passed to the only surviving son Adam Wenceslaus, who in 1610 shifted back to Roman Catholicism for the sake of political advantage and enacted several Counter-Reformation measures. Indeed, Emperor Matthias appointed him Silesian governor in 1617, however, he died a few months later. The Cieszyn Piast rule continued until 1653, when the male line became extinct with the death of Adam Wenceslaus' son Frederick William amidst the Thirty Years' War in 1625. The intentions of the Habsburg rulers to seize the duchy as a reverted fief were initially thwarted by his surviving sister, Duchess Elizabeth Lucretia, who began a lengthy lawsuit on her heritage. Nevertheless, when she died in 1653, the duchy passed directly to the Bohemian monarchs, at that time the Habsburg emperor Ferdinand III and his son King Ferdinand IV. Habsburg rule Ferdinand IV ruled Teschen until his death in 1654, whereafter the duchy fell back to Emperor Ferdinand III. His Habsburg successors continued the re-Catholicization policies. In 1722 Emperor Charles VI separated Teschen from the Bohemian Crown and granted the duchy to Duke Leopold of Lorraine, whose son Francis I was to marry Charles's daughter Maria Theresa. Leopold had unsuccessfully claimed his maternal grandmother's rights to the north Italian Duchy of Montferrat, which Charles had taken and given to the Dukes of Savoy in 1708 as part of their alliance pact. Once Holy Roman Emperor, Francis had to face the attack by the Prussian king Frederick the Great, who after the 1742 Peace of Breslau took the bulk of Silesia, while Teschen remained with the Habsburg Monarchy. In 1766 Teschen passed to Francis' eldest surviving daughter, Archduchess Maria Christina and her husband Prince Albert of Saxony, who thus became known colloquially as the Duke of Saxe-Teschen. Although most of Silesia had passed to Prussia, Teschen with Bielsko and the duchies of Krnov (Jägerndorf), Opava (Troppau) and southern part of episcopal Nysa (Neisse) remained under Habsburg control and passed to the newly established Austrian Empire in 1804. Archduchess Maria Christina had died in 1798 and as her marriage remained childless, upon the death of the widowed Albert in 1822 the duchy passed to their adopted son, Archduke Charles of