Forts in Sri Lanka date back thousands of years, with many being built by Sri Lankan kings. These include several walled cities. With the outset of colonial rule in the Indian Ocean, Sri Lanka was occupied by several major colonial empires that from time to time became the dominant power in the Indian Ocean. The colonists built several western-style forts, mostly in and around the coast of the island. The first to build colonial forts in Sri Lanka were the Portuguese; these forts were captured and later expanded by the Dutch. The British occupied these Dutch forts during the Napoleonic wars.
Most of the colonial forts were garrisoned up until the early 20th century. The coastal forts had coastal artillery manned by the Ceylon Garrison Artillery during the two world wars. Most of these were abandoned by the military but retained civil administrative officers, while others retained military garrisons, which were more administrative than operational. Some were reoccupied by military units with the escalation of the Sri Lankan Civil War; Jaffna fort, for example, came under siege several times.