The Visegrad Castle was built in the 12th century during the Anjou dynasty and was one of the earliest palaces built on the Danube River. Historically, Visegrad was a military town, and the castle was built here to defend against the Tatar invasion, but it still failed to defend against the Turks.