In 1346, the vicinities of Olsztyn, as separate bailiwick, found itself in the hands of a chapter of canons, who quickly began to think about the creation of an administrative and defense center in this region. The center was located in a naturally perfectly fortified place, where the elevation of the area from the south and west was surrounded by the meandering Łyna river. Soon, the construction of the castle began, and the nearby developing settlement received the location privilege on October 31, 1353. The chapter commissioned the city to be founded by Johannes von Leysen.