[1][2] Following the Treaty of Fontainebleau signed between France and Spain in October 1807, which agreed on the invasion of Portugal, French troops under the command of General Junot entered the country, which requested support from the British.
In March 1809, Marshal Soult led a new French expedition that advanced south to the city of Porto before being repulsed by Portuguese-British troops and forced to withdraw.
However, the threat of further invasions by the French led Wellington, on October 20, 1809, to order the construction of defensive lines to the north of the capital, between the Atlantic Ocean and the River Tagus.
The Lines of Torres Vedras, consisting of 152 forts, redoubts and other military installations, were built rapidly and in conditions of great secrecy, under the overall supervision of Colonel Richard Fletcher who was commander of the Royal Engineers.
It was on the first, or most northerly, of the three lines, exchanging crossfire with the nearby Fort of Cego, and had the responsibility of protecting the Arruda Valley against French incursion.