The castle was built between the 11th and 14th centuries and became the seat of the counts of Vianden. It was further developed until the 18th century but with the departure of the Counts of Luxembourg to the Netherlands combined with the effects of fire and an earthquake, it slowly deteriorated. The final blow came in 1820 when William I of the Netherlands sold it to a local merchant who in turn sold off its contents and masonry piecemeal, reducing it to a ruin. There were several attempts at restoration but these were hampered by problems of ownership. Still, the chapel which forms part of it was restored in 1849 by Prince Henry of the Netherlands, and during one of his visits to the town Victor Hugo lived in the castle for three months in 1871. Not until 1977, when Grand Duke Jean ceded the castle to the State, was it possible to undertake large-scale work, most of which has now been completed.