<P> A castle (from Latin: castellum) is a type of fortified structure built in Europe and the Middle East during the Middle Ages by European nobility . 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 palace, which is not fortified; from a fortress, which was not always a residence for nobility; and from a fortified settlement, which was a public defence--though there are many similarities among these types of construction . Usage of the term has varied over time and has been 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 with many different features, although some, such as curtain walls and arrowslits, were commonplace . </P> <P> A European innovation, castles originated in the 9th and 10th centuries, after the fall of the Carolingian Empire resulted in its territory being divided among individual lords and princes . These nobles built castles to control the area immediately surrounding them, and the castles were both offensive and defensive structures; they provided a base from which raids could be launched as well as protection from enemies . Although their military origins are often emphasised in castle studies, the structures also served as centres of administration and symbols of power . Urban castles were used to control the local populace and important travel routes, and rural castles were often situated near features that were integral to life in the community, such as mills, fertile land, or a water source . </P> <P> Many castles were originally built from earth and timber, but had their defences replaced later by stone . Early castles often exploited natural defences, lacking features such as towers and arrowslits and relying on a central keep . In the late 12th and early 13th centuries, a scientific approach to castle defence emerged . This led to the proliferation of towers, with an emphasis on flanking fire . Many new castles were polygonal or relied on concentric defence--several stages of defence within each other that could all function at the same time to maximise the castle's firepower . These changes in defence have been attributed to a mixture of castle technology from the Crusades, such as concentric fortification, and inspiration from earlier defences, such as Roman forts . Not all the elements of castle architecture were military in nature, so that devices such as moats evolved from their original purpose of defence into symbols of power . Some grand castles had long winding approaches intended to impress and dominate their landscape . </P>

When was the first castle built in the world