the Duchy, Cieszyn developed quickly and increased its significance. It also became a religious center of the duchy, after creation of a deaconry in the early 14th century. The largest development occurred during the rule of Przemysław I Noszak, who gained the city rights for Cieszyn in 1374 and reconstructed the wooden castle into the bricked one. It was back then when the mayor and city council appeared, in 1387 first known mayor being Mikołaj Giseler. Town hall for the city council has been built. Another rapid development of the town occurred during the rule of Casimir II, who invested in infrastructure of the town and erected defense walls around Cieszyn. Casimir II also founded a new market square and donated buildings for a new city council which serve the city to this day. In the 16th century the town became an important centre of trade and commerce, with significant manufacture of arms and jewelry. It also became a centre of the Reformation. The town gradually developed until the 17th century, when it was heavily damaged during the Thirty Years' War. As a result of the war, economic and demographic decline followed in the whole Duchy. The rule of the Cieszyn Piast dynasty continued to 1653, ending with the death of the last Duchess Elizabeth Lucretia. Thereupon the duchy lapsed directly to the Kings of Bohemia, at that time Ferdinand IV of Habsburg. The Habsburg takeover of the duchy caused economic and political stagnation of Cieszyn until the end of the century. Cieszyn under Habsburg rule The end of the era of Counter-Reformation allowed the construction of a large Lutheran church in Cieszyn in 1709–1750. The role of Teschen strengthened after the end of the Silesian Wars in the 18th century. As a result of the wars, Cieszyn Silesia remained part of Austria. On 13 May 1779 the Peace of Teschen ending the War of Bavarian Succession has been signed in the town by Austria and Prussia. In 1772 Cieszyn also served as the main seat of the Bar Confederation. Development of the town has been halted by the great fire of 1789, which damaged nearly the whole town. Since late 18th century German culture began to dominate in the town. In the 19th century Cieszyn underwent rapid cultural and educational development. In 1802 the priest Leopold Szersznik created a museum which later became a Museum of Cieszyn Silesia, one