Scottish castles are buildings that combine fortifications and residence, built within the borders of modern Scotland. Castles arrived in Scotland with the introduction of feudalism in the twelfth century. Initially these were wooden motte-and-bailey constructions, but many were replaced by stone castles with a high curtain wall. During the Wars of Independence, Robert the Bruce pursued a policy of castle slighting. In the Late Middle Ages, new castles were built, some on a grander scale as "livery and maintenance" castles that could support a large garrison. Gunpowder weaponry led to the use of gun ports, platforms to mount guns and walls adapted to resist bombardment. Many of the late Medieval castles built in the borders were in the form of tower houses, smaller pele towers or simpler bastle houses. From the fifteenth century there was a phase of Renaissance palace building, which restructured them as castle-type palaces, beginning at Linlithgow. Elements of Medieval castles, royal palaces and tower houses were used in the construction of Scots baronial estate houses, which were built largely for comfort, but with a castle-like appearance. In the seventeenth and eighteenth centuries the military significance of castles declined, but they increasingly became tourist attractions. Elements of the Scots Baronial style would be revived from the late eighteenth century and the trend would be confirmed in popularity by the rebuilding of Balmoral Castle in the nineteenth century and its adoption as a retreat by Queen Victoria. In the twentieth century there were only isolated examples of new castle-influenced houses. Many tower houses were renovated, and many castles were taken over by the National Trust for Scotland or Historic Scotland and are open to the public. Middle Ages Castles, in the sense of a fortified residence of a lord or noble, arrived in Scotland as a consequence of the centralising of royal authority in the twelfth century. Prior to the 1120s there is very little evidence of castles having existed in Scotland, which had remained less politically centralised than in England with the north still ruled by the kings of Norway. David I of Scotland (r. 1124–53) spent time at the court of Henry I of England, becoming Earl of Huntingdon, and returned to Scotland with the intention of extending royal power across the country and modernising Scotland's military technology, including the introduction of castles. The Scottish king encouraged Norman and French nobles to settle in Scotland, introducing