<P> In the 12th century, a castle was built on this site . Two centuries later, in 1392, King Charles VI turned the County of Valois (of which Pierrefonds was part) into a Duchy and gave it to his brother Louis, Duke of Orléans . From 1393 to his death in 1407, the latter had the castle rebuilt by the court architect, Jean le Noir . </P> <P> In March 1617, during the early troubled days of Louis XIII's reign, the castle, then the property of François - Annibal d'Estrées (brother of the beauty Gabrielle d'Estrée), who joined the "parti des mécontents" (party of discontent) led by Henri II, Prince of Condé, was besieged and taken by troops sent by Richelieu, the secretary of state for war . Its demolition was started, but not carried through to the end because of the enormity of the task . The exterior works were razed, the roofs destroyed and holes made in the towers and curtain walls . </P> <P> The castle remained a ruin for more than two centuries . Napoleon I bought it in 1810 for less than 3,000 francs . During the 19th century, with the rediscovery of the architectural heritage of the Middle Ages, it became a "romantic ruin": in August 1832, Louis - Philippe gave a banquet there on the occasion of the marriage of his daughter Louise to Léopold de Saxe - Cobourg Gotha, first king of the Belgians . Among other artists, Corot depicted the ruins in several works between 1834 and 1866 . The Château de Pierrefonds has been classified as a monument historique by the French Ministry of Culture since 1848 . </P> <P> Louis - Napoléon Bonaparte (later Napoleon III of France) visited the castle in 1850 . As emperor, he asked Viollet - le - Duc in 1857 to undertake its restoration, continuators are Maurice Ouadou and Juste Lisch until 1885 . There was no question of a simple repair to the habitable parts (the keep and annexes): the "picturesque" ruins in front were to be kept for decor . In 1861, the project grew in scale: the sovereign wanted to create an imperial residence, so the castle was to be entirely rebuilt . The works, which would cost 5 million francs, of which 4 million were to come from the civil list, were stopped in 1885, six years after the death of Viollet - le - Duc . The departure of Napoléon III had halted the reconstruction and, through lack of money, the decoration of rooms was unfinished . Inside, Viollet - le - Duc produced more a work of invention than restoration (polychrome paintings). He imagined how the castle ought to have been, rather than basing his work on the strict history of the building . On the other hand, with the exterior he showed an excellent knowledge of the military architecture of the 14th century . </P>

What castle is used in the tv series merlin