since poland's king casimir iii, who had recognised bohemian feudality for silesia in 1335, silesia belonged to the holy roman empire. emperor charles iv then integrated silesia into the reich. under the rule of the silesian piasts, silesia was divided into 17 principalities. the majority of silesia was conquered by king frederick ii of prussia during the three silesian wars (1740–1763) from austria. at the end of the first silesian war, the peace of wroclaw and the treaty of berlin from 1742 stood. in accordance with the treaty, the duchy of lower silesia and the county of kladsko passed "from the crown of bohemia" to frederick in full sovereignty and independence. he received silesia, with the exception of the duchy of teschen, the city of troppau, and the part beyond the oppa and the high mountains, the hennersdorf domination, and the moravian enclaves in silesia as well as the southern part of the duchy of nysa near austria and the duchy of krnov. the moravian enclave kietrz and the former bohemian county of kladsko went to prussia. in the treaty of dresden, which ended the second silesian war in 1745, the provisions remained intact. the empire guaranteed this peace in 1751. in his capacity as king of bohemia, the austrian emperor also retained the title of duke of upper and lower silesia, as can be gathered from the grand title of emperor franz joseph i.