In the 13th century a Hospitaller and Franciscan monastery were founded in the town, which thus became one of the important cultural and religious centres of the region. During the Mongol invasion of Poland, in 1241 many of the miners took part in the Battle of Legnica, where most of them died, but the mining quickly recovered. During the ongoing fragmentation of Poland into smaller duchies, in 1248 the town was attached to the newly established Duchy of Legnica and in 1290 was granted with a privilege to trade salt, one of the most expensive and valuable minerals in the Middle Ages. In 1329, under the rule of Duke Bolesław III the Generous, the whole Duchy of Legnica became a fief of the Kingdom of Bohemia under King John the Blind, yet it retained its local self-government. During the 15th century Hussite Wars the town was captured by the Hussite forces in 1427, 1428 and 1431. It was severely pillaged, but it quickly recovered and the local city council decided to build city walls in order to spare the city such troubles in the future. Much of the mediaeval fortifications is preserved until today. Early modern period Although by the early 15th century most of the gold deposits were depleted, the town started to gain significant income from the nearby Via Regia trade route linking Wrocław with Leipzig. A brewery and several weavers shops were opened soon afterwards. In 1504 a school was opened by Hieronymus Aurimontanus. In 1522 the first Protestant priests arrived and soon afterwards the school was turned into a Latin, humanistic gymnasium, the first in Silesia. One of its rectors, Valentin Trozendorf, wanted to turn it into a university and these plans were approved by Duke Frederick II of Legnica; however the prince died soon afterwards and the town was struck by a severe fire in 1554, which made the plans obsolete. Nevertheless, the school attracted students from Silesia, Greater Poland and Bohemia. In 1526 the town together with the rest of the Bohemian crown land of Silesia came under the suzerainty of the Austrian House of Habsburg. It remained part of the Piast-ruled Duchy of Legnica until 1675. Goldberg continued to prosper until 1608, when the prosperity was stopped by a major flood that killed approx. 50 of the inhabitants and damaged large part of the city. Five years later, in 1613 the town yet