Construction of the Melsztyn Castle was initiated in 1340, by the castellan of Kraków, Spicymir. In 1362, Bishop Bodzanta blessed the Holy Spirit chapel at the castle. The complex for 200 years remained in the hands of the powerful noble family of Leliwita Melsztyński, which in the late 14th century built a Gothic keep, located in the western wing of the castle. In the 15th century, Melsztyn was one of centers of Polish Hussite movement, and in 1511, Jan Melsztyński sold it to the castellan of Wiślica, Mikołaj Jordan of Myślenice. In ca. 1546, Spytek Jordan ordered remodeling of the Gothic complex, turning it into a Renaissance residence. After the marriages of his two daughters, Melsztyn became the property of the Tarło family, and in 1744, it came into the hands of the Lanckoroński family.
Melsztyn Castle was destroyed by the Russians in 1771, during the Bar Confederation, and has been a ruin since then. In 1789–1796, parts of the complex were pulled down, in order to gain building materials for a church at Domosławice. In the following years, the complex was neglected, which resulted in collapse of the keep (1846). In 1879-85, due to the efforts of Karol Lanckoroński, the castle gained the status of a permanent, protected ruin. Since 2008, it belongs to the gmina of Zakliczyn. The castle has been presented in paintings of Jan Matejko, Napoleon Orda, and Maciej Bogusz Steczyński.
References:Celje Castle was once the largest fortification on Slovenian territory. The first fortified building on the site (a Romanesque palace) was built in the first half of the 13th century by the Counts of Heunburg from Carinthia on the stony outcrop on the western side of the ridge where the castle stands. It had five sides, or four plus the southern side, which was a natural defence. The first written records of the castle date back to between 1125 and 1137; it was probably built by Count Gunter. In the western section of the castle, there was a building with several floors. Remains of the walls of this palatium have survived. In the eastern section, there was an enclosed courtyard with large water reservoirs. The eastern wall, which protects the castle from its most exposed side, was around three metres thicker than the rest of the curtain wall. The wall was topped with a parapet and protected walkway.