A castle is a defensive structure seen as one of the main symbols of the Middle Ages. The term has a history of scholarly debate surrounding its exact meaning, but it is usually regarded as being distinct from the general terms fort or fortress in that it describes a residence of a monarch or noble and commands a specific defensive territory.
Roman forts and hill forts were the main antecedents of castles in Europe, which emerged in the 9th century in the Carolingian Empire. The advent of cannon and gunpowder changed the needs of warfare in Europe, limiting the effectiveness of the castle and leading to the rise of the fort.
Similar constructions in Russia (Kremlin) and feudal Japan (Shiro) are also considered castles.