The Royal Castle was built at the southern end of the plateau, the civilian town to the north. At first the town was protected only by fences and the walls of the houses, but by the early sixteenth century it was surrounded by strong ramparts. This
A street in the Castle District-as it was destroyed in the Second World War is why the Turks in 1541 did not lay siege to Buda but captured it by trickery; later they further fortified the ramparts. It was only after repeated sieges that the united Christian armies succeeded in 1686 in recapturing Buda Castle. The country then came under the rule of the Habsburg Emperor Leopold. The city of Buda was almost completely destroyed by the siege and only a handful of inhabitants remained; therefore, in order to repopulate the town, settlers were invited from abroad. The former capital sank to the status of a small provincial town in the Habsburg Empire.
Then, during the eighteenth century, a little Baroque town grew up on the medieval ruins. Not much more than 150 years after the Turkish devastation, in 1849, during the Hungarian War of Independence, the Castle was again besieged and it was only in 1867- when, as a result of the Compromise with the Habsburg dynasty, an independent Hungarian government was created-that the Castle District once more became the administrative centre of the country.
Towards the end of the Second World War, it was in the Castle District that the last Nazi German troops concern treated and held out, from the end of December 1944 until the middle of February 1945, when the Soviet Red Army liberated the capital after a siege lasting almost two months. As a consequence of the Germans' bitter resistance the Castle District again suffered enormous damage. Part of the medieval remains that can now be seen were discovered during the reconstruction of houses which were found to have been built upon the foundations of earlier ones.