In 1795 it was annexed by Austria in the Third Partition of Poland. It was regained by Poles as a result of the Austro-Polish War in 1809 and became part of the short-lived Polish Duchy of Warsaw, and in 1815, for the first time in history, it was administratively separated from Kraków, as together with Olkusz, it became part of Russian-controlled Congress Poland, while the city of Kraków remained in Austrian Galicia. After Poland regained independence, in 1918–1939 it belonged to Second Polish Republic’s Kielce Voivodeship. Following the joint German-Soviet invasion of Poland, which started World War II in 1939, it was under German occupation until 1945. After the war it was transferred to the Kraków Voivodeship.