After the Third Partition of Poland, in 1795, it was annexed by the Kingdom of Prussia, and included within the newly formed province of New Silesia.
After the unsuccessful Polish January Uprising, Ogrodzieniec, like many other locations of Lesser Poland, lost its town charter (1870).
In September 1939, during the German invasion of Poland, which started World War II, German troops massacred a group of Polish boy scouts from Ogrodzieniec in Tucznawa, and also carried out executions of Poles in Ogrodzieniec (see Nazi crimes against the Polish nation).
It is located on Góra Zamkowa, the highest hill of the Polish Jura (515 meters above sea level).
In 1241, during the Mongol invasion of Poland, it was burned and destroyed, and in the mid-14th century, new, stone complex of a mighty Gothic castle was built here.
The castle guarded western border of Lesser Poland, and in 1470 it was purchased by the Salomon family, merchants from Kraków.
It then changed hands several times, belonging to the Rzeszowskis, Pileckis, Chełmińskis and finally, the Boner family (since 1523).
In 1562, Boner's daughter Zofia married Jan Firlej, and the castle, as a dowry, changed hands once more.
After World War II, the castle was nationalized, and its walls were strengthened in 1949 - 1973, which prevented total collapse of the complex.
The castle is popular among film makers; in 1973, some episodes of the TV series Janosik were made here, and in 2001, Andrzej Wajda shot The Revenge here.