 Throughout the medieval era, castles and fortresses known as "Qalcads" were built by Somali Sultans for protection against both foreign and domestic threats.The major medieval Somali power engaging in castle building was the Ajuran sultanate, and many of the hundreds of ruined fortifications dotting the landscapes of Somalia today are attributed to Ajuran engineers.Other castle building powers were the Gerad Kingdom and the Bari Sultanate.