 One of Spain 's principal goals upon its entry into the American War of Independence in 1779 was the recovery of Gibraltar , which had been lost to England in 1704 . The Spanish planned to retake Gibraltar by blockading and starving out its garrison , which included troops from Britain and the Electorate of Hanover . The siege formally began in June 1779 , with the Spanish establishing a land blockade around the Rock of Gibraltar . The matching naval blockade was comparatively weak , however , and the British discovered that small fast ships could evade the blockaders , while slower and larger supply ships generally could not . By late 1779 , however , supplies in Gibraltar had become seriously depleted , and its commander , General George Eliott , appealed to London for relief . 
