Casimir II the Just
After the fragmentation of the Polish kingdom upon the 1138 Testament of Bolesław III Krzywousty the lands around the castellany of Pszczyna belonged to the Seniorate Province of Lesser Poland ("Małopolska"), until in 1177 Duke Casimir II the Just granted them to the Silesian duke Mieszko I Tanglefoot. Mieszko attached Pszczyna to his Duchy of Racibórz. The Racibórz branch of the Silesian Piasts became extinct with the death of Duke Leszek in 1336.