Castles were first built in the 9th century and the practice continued up to the 16th century. A castle was both a home for someone important like a king or noble, and a fort. Castles were designed to keep people out and show how powerful the people inside were. They were sometimes used in war, with many famous sieges like the siege of Kenilworth in 1266 which lasted for six months, or Stirling Castle which was besieged eight times.