This fort was just one part of a whole line of defence known as the Lines of Contravallation of Gibraltar. This fortification was constructed by the Spanish after Gibraltar was formerly ceded to the United Kingdom after being captured by an Anglo-Dutch force in 1704. The agreement to cede the isthmus was part of the Treaty of Utrecht and Spain gave Britain Menorca, Gibraltar and the right to sell slaves to Spanish colonies. As a result, a defensive line (hence "La Línea") was built at the north end of the isthmus joining the Rock of Gibraltar to Spain in order to keep the British from attacking or encroaching on Spain.