The castle was first mentioned in 1274 with the German name Luegg, when the Patriarch of Aquileia built the castle in Gothic style. The castle was built under a natural rocky arch high in the stone wall to make access to it difficult. It was later acquired and expanded by the Luegg noble family, also known as the Knights of Adelsberg.
The castle became known as the seat of the knight Erasmus of Lueg, lord of the castle in the 15th century and a renowned robber baron. He was the son of the imperial governor of Trieste, Nikolaj Lueger. According to legend, Erasmus came into conflict with the Habsburgs when he killed the commander of the imperial army, Marshal Pappenheim, who had offended the honour of Erasmus's deceased friend and famous condottiereAndrej Baumkircher of Vipava. Fleeing the vengeance of the Holy Roman Emperor Frederick III, Erasmus reached the family fortress of Predjama. From there, he allied himself with King Matthias Corvinus and began to attack Habsburg estates and towns in Carniola. The emperor commissioned the governor of Trieste, Andrej Ravbar, with the capture or killing of Erasmus. Erasmus was killed after a long siege. According to a popular but unfounded legend, Erasmus was betrayed by one of his men and was killed by a shot from a cannon in his lavatory.
After the reconstruction
After the siege and destruction of the original castle, its ruins were acquired by the Oberburg family. In 1511, the second castle, built by the Purgstall family in the first decade of the 16th century, was destroyed in an earthquake. In the year 1567, Archduke Charles of Austria leased the castle to Baron Philipp von Cobenzl, who paid it off after 20 years. In 1570, the current castle was built in the Renaissance style, pressed next to a vertical cliff under the original Medieval fortification. The castle has remained in this form, virtually unchanged, to the present day. In the 18th century, it became one of the favourite summer residences of the Cobenzl family. Both the Austrian statesman and famous art collector Philipp von Cobenzl and the diplomat Count Ludwig von Cobenzl spent time in the castle. In 1810, the castle was inherited by Count Michael Coronini von Cronberg, and in 1846 it was sold to the Windischgrätz family, who remained its owners until the end of World War II, when it was confiscated and nationalized by the Yugoslav Communist authorities and turned into a museum.
Hidden passageway
A vertical natural shaft, which Erasmus ordered to be enlarged, leads out of the original castle, and leads to the exit located at the top of the cliff, 25 meters away from the cliff's edge. This shaft allowed Erasmus to secretly supply the castle with food in the time of the siege; he also used it to continue with his robberies.