In the 13th century the inhabitants of this area were affected by the invasion of the Mongols. Following that difficult period, Hungarian kings invited new colonists from Germany to settle in the region to help replenish the decimated population. Their innovative technology and knowledge restored the mining activities in the town. The first written reference to the town dates back to 1328, when it was granted royal town privileges by King Charles I of Hungary.