Opole's history begins in the 8th century. At this time, according to the archeological excavations, the first settlement was founded on the Ostrówek – the northern part of the Pasieka Island in the middle of the Oder river. In the early 10th century it developed into one of the main "gords" of the Lechitic (Polish) Opolans tribe. At the end of the century Silesia became part of Poland and was ruled by the Piast dynasty; the land of the pagan Opolanie was conquered by Duke Mieszko I in 992. From the 11th–12th centuries it was also a castellany. After the death of Duke Władysław II the Exile, Silesia was divided in 1163 between two Piast lines – the Wrocław line in Lower Silesia and the Opole-Racibórz of Upper Silesia. Opole would become a duchy in 1172 and would share much in common with the Duchy of Racibórz, with which it was often combined. In 1281 Upper Silesia was divided further between the heirs of the dukes. The Duchy of Opole was temporarily reestablished in 1290. In the early 13th century, Duke Casimir I of Opole decided to move the settlement from the Pasieka Island to the right shore of the Oder river (since the 17th century, the old stream bed of the Oder, known as the Młynówka). All of the inhabitants had to be moved in order to accommodate the castle that was built in place of the old city. Former inhabitants of Ostrówek, together with German merchants that immigrated from the West, received the first town rights probably as early as around 1217, although this date is disputed. Opole received German town law in 1254, which was expanded with Neumarkt law in 1327. Opole developed during the rule of duke Bolko I of Opole. The castle was finally completed around this time and new buildings, including the city walls and the Holy Cross Church, were constructed. Along with most of Silesia, in 1327 the Duchy of Opole came under the sovereignty of the Kingdom of Bohemia, itself part of the Holy Roman Empire. In 1521 the Duchy of Opole inherited the Duchy of Racibórz (Ratibor), by then also known by its German equivalent – Oppeln. The second castle of Opole was probably founded in the 14th century by duke Vladislaus II, though some sources claim that it was originally a wooden stronghold of Opole's castellan dating into 12th century.