The origins of Kasbahs in Morocco can be traced back to the Berbers, who built these fortified structures to protect their communities from external threats. The earliest Kashbahs date back to the 7th century, though many of the structures still existing today were bult during the medieval period. These fortresses were often expanded and renovated by successive dynasties, each leaving their mark on the architecture. They were typically built from rammed earth and sun-dried mud.