The castle was built for the order of king Bela IV, after the invasion of the Mongols in 1241-42, by the Tomaj family. It was first mentioned in 1282, when it became the property of the king. In the next centuries the ownership of the castle changed several times, eg. it was owned by king Laszlo IV, Aba Amade, Karoly Robert, the Drugeth family, king Zsigmond, Czudar Peter, Brankovics Gyorgy, king Matthias, Szapolyai Janos, Bathori Istvan, Martinuzzi Frater Gyorgy, the Bebek family, Rakoczi Gyorgy I., etc. The Germans blew it up in 1702 - like nearly all other castles in the Kingdom of Hungary - after the lost war for independence led by Rakoczi Ferenc II. Its last owners were the Zichys before the nationalization in 1947.