Niedzica Castle also known as Dunajec Castle, is located in the southernmost part of Poland in Niedzica (Nowy Targ County in Lesser Poland). It was erected between the years 1320 and 1326 by Kokos of Brezovica on the site of an ancient stronghold surrounded by earthen walls in the Pieniny mountains. The Niedzica Castle stands at an altitude of 566 m, on a hill 300 m upstream from the Dunajec River mouth, measured from the center of the dam on Czorsztyn Lake. The outline of Niedzica Castle can best be viewed from the ruins of Czorsztyn Castle on the other side of the lake. It is known as one of the most picturesque castles in the country and adorns the covers of many books.
The castle was an important centre of Polish-Hungarian relations since the 14th century. It was a place where the money lent by the Polish king to the Hungarian king Sigismund had to be returned following an agreement signed in 1412. Once the loan was paid back, the Polish king returned the 16 Spiš towns given to him by Sigismund as collateral. For centuries the castle was a border-post with Hungary. At the time of the Turkish invasion five hundred years ago, a deal was struck at Niedzica to make it a Polish protectorate.
The castle was built by a Hungarian known as Kokos from Brezovica with family rights dating back to 1325. In 1470 it became the property of the aristocratic Zapolya family. However, in 1528, the entire county including the castle was given away by John Zapolya aspiring to the Hungarian throne, and became the property of Viliam Drugeth who received it as a reward for his support. Sixty years later it became the property of Hieronim Łaski and his son Olbracht. At the end of the 16th century the castle was bought by Jan Horvath from Plaveč[disambiguation needed]. The fortress was renovated many times in the fifteenth, sixteenth, eighteenth and in the beginning of the 19th century by its successive owners. The last Hungarian inhabitants remained there until in 1943 when the coming of the front in World War II inspired the Salamon family to abandon it. The last countess left with her children two years before the Red Army marched in. The final reconstruction of the castle was completed in 1963 under the supervision of the Polish Ministry of Culture. It has served as a historical museum ever since.