The origin of the Ľubovňa castle dates back to the second half of the 13th century, resp. to the beginning of the 14th century. The castle was established as a border guard castle, protecting trade routes to Poland. According to some sources (Menclová, Slivka, Čaplovič, Chalupecký) it was probably built around 1280 by the Polish prince Boleslav, who was the husband of Kunigunda, daughter of the Hungarian king Bel IV. At this time, a circular tower and a Gothic palace were built. At the beginning of the 14th century, the castle was expanded by another, east-facing palace, and further construction of the castle was accelerated by state changes after 1299 as well as the internal political struggles of the oligarchs against the central royal power. In the years 1308 - 1312 the castle belonged to the Omodej family, and from 1315 to the Druget family. According to other sources (Beňko, Fügedi, Števk) the castle was built at the beginning of the 14th century on the initiative of King Karol Róbert (the first written mention is from 1311, when it is mentioned under the name "Liblou"). And according to other sources, preserved among the people rather than a legend, the castle was founded by the nobleman Ľubovenský, who liked the place where the castle stands. The first administrators were the Omodej family, not Matúš Čák, as the literature states, he was only an ally of the Omodej family against the monarch, when they wanted to appropriate the castle, which they did not succeed, because Karol Róbert defeated the Omodej family in 1312.