This is a list of castles in Scotland. A castle is a type of fortified structure built during the Middle Ages. Scholars debate the scope of the word "castle", but usually consider it to be the private fortified residence of a lord or noble. This is distinct from a fortress, which was not a home, although this distinction is not absolute and the same structure may have had different uses from time to time. The term has been popularly applied to structures as diverse as hill forts and country houses. Over the approximately 900 years that castles were built, they took on a great many forms. In Scotland, earlier fortifications had included hill forts, brochs, and duns; and many castles were on the site of these earlier buildings. The first castles were built in Scotland in the 11th and 12th centuries, with the introduction of Anglo-Norman influence. These motte and bailey castles were replaced with the first stone-built castles from around 1200. By the late 14th century, the large curtain-walled castles had begun to give way to more modest tower houses – vertical dwellings with less formidable defences. This type of vertical house continued to be popular with Scotland's landowning class through to the late 17th century, when classical architecture made its first appearance in the country. Meanwhile, the advance of artillery pressed military engineers to devise stronger fortifications for important royal strongholds. Tower houses and castles were often given painted ceilings and decorative plasterwork in the 16th and 17th centuries, employing distinctive national styles. In the late 18th century, forms found in medieval Scottish architecture were revived and castle-style houses were constructed. These "castles" had no defensive capability, but drew on military and tower house architecture for their decorative details. This architectural trend culminated in the Scottish Baronial style of the 19th century. There have been well over two thousand castles in Scotland, although many are known only through historical records. They are found in all parts of the country although tower houses and peel towers are concentrated along the border with England, while the best examples of larger Renaissance-era tower houses are clustered in the north-east. There is some discussion about whether Scottish castles can be considered to be "true" castles, although this discussion is mainly focused around opinions held by some scholars as per the exact scope of the word castle.