The settlement in the episcopal Duchy of Nysa within fragmented Poland was established about 1220 by Bishop Wawrzyniec of Wrocław, who invited German settlers to build up a stronghold against the threatening forces of the Přemyslid margrave Vladislaus III of Moravia, brother of King Ottokar I of Bohemia. It was granted town rights between 1220 and 1249. In the mid-13th century, the church of St. Lawrence was built, the name of which probably refers to the town's founder, bishop Wawrzyniec ("Lawrence"). The place soon became an important site of iron ore and gold mining, later run by the Thurzó and Fugger families. By the mid-14th century the defensive walls and tower were erected. The town was devastated in 1428 during the Hussite Wars. In 1445 it passed to Duchy of Głogówek under local Polish Duke Bolko V the Hussite and in 1450 it was again reintegrated with the Duchy of Nysa, and remained part of it in the following centuries.