The beginnings of the Lublin castle are related to the establishment of the Lublin castellany in the 12th century. In the times of Kazimierz the Just, a stronghold was erected on the hill, reinforced with a wooden and earth rampart. In the mid-13th century, a brick defensive and residential tower (keep) was built within the upper part of the hill. It is a valuable monument of Romanesque art that has survived to this day. The keep strengthened the location of the medieval complex, because it supported and secured access to the castellan’s seat. It performed primarily military functions, but also served as a shelter in case of danger.
In the 14th century, during the reign of Kazimierz the Great, a brick castle was erected, surrounded by a defensive wall. It was most likely then that the Gothic castle church of the Holy Trinity was also built, which served as the royal chapel.
Due to the foundation of Władysław Jagiełło, the gothic interior of the chapel was covered with Rutheno-Byzantine frescoes. The works were completed in 1418. Thanks to the combination of western, gothic architecture and eastern paintings, the Holy Trinity Chapel is a unique monument of sacred art on an international scale.
In the 16th century, the castle, lying on the royal route from Krakow to Vilnius, enjoyed the interest of the Jagiellonians. Here, under the tutelage of Jan Długosz, the sons of Kazimierz Jagiellończyk grew up. Around 1520, Zygmunt the Old initiated the reconstruction of the castle into a magnificent royal residence, employing, among others, Italian masters brought from Krakow. A second storey was added, intended exclusively for the king and his court, and an entrance gate was erected.
In 1569, the Sejm, at which the act of joining Poland and Lithuania into the Polish-Lithuanian Commonwealth, known as the Union of Lublin, was concluded and sworn in, debated within the walls of the castle. During this period, King Zygmunt Augustus and his court stayed in the castle for almost a year, receiving parliamentary deputies and foreign envoys.
In the second half of the 17th century, as a result of numerous hostilities and fires, the castle fell into ruin. The inspection of the Lublin starosta from 1661 describes the condition of the castle as follows: “all this ruined, needs a considerable sum for restoration […] burned by the enemy, the rest collapsed”. The image of the castle hill on the painting Fire of Lublin in 1719 confirms the extent of the damage. Only the oldest buildings– the chapel and the keep – survived.
In 1824–1826, due to the initiative of Stanisław Staszic and according to the design by Jan Stompf, a new building in the English neo-Gothic style was erected on the ruins of the former castle, intended for the criminal prison of the Congress Poland, including the chapel and the keep within its walls. The castle served as a prison for 128 years.
From 1831 to 1915, it was a location of a tsarist prison, intended mainly for participants of the fight for independence, such as the January insurgents.
In 1918–1939, a penal and investigative prison was located in the castle, in which, along with criminal prisoners, members of the communist party sentenced for activities against the Polish state were serving their sentences.
During World War II, in 1939–1944, the castle housed the Nazi prison of the Security Police and Security Service in Lublin. In total, ca 40,000 people were imprisoned there, mainly members of the resistance movement. The prison had a temporary character, a large proportion of the inmates were sent to German concentration camps, incl. KL Lublin (Majdanek), KL Auschwitz, KL Sachsenhausen, KL Ravensbrück, KL Dachau. On 22 July 1944, before leaving Lublin, the Nazis killed about 300 prisoners of the castle.
After the liberation from Nazi occupation, in September 1944, a political penal and investigative prison was organised in the castle, subordinated to the Soviet authorities, and then to the Ministry of Public Security. In 1944–1954, ca 35,000 Poles who opposed the communist occupation were held here. Out of 515 death sentences issued here, ca 180 were carried out.
After the prison was closed in 1954 and renovation and adaptation works were carried out, the castle was designated for cultural purposes. On 21 July 1956 the headquarters of the Museum were officially opened in the castle.