[1][2] Despite the defeat of French forces in earlier invasions of Portugal during the Peninsular War, the threat of further invasions led the commander of the British troops in Portugal, Arthur Wellesley, 1st Duke of Wellington, to order on October 20, 1809, the construction of three 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 works, were built rapidly and in great secrecy, under the overall supervision of Colonel Richard Fletcher who was commander of the Royal Engineers.
The French army arrived at the lines on 11 October and took the village of Sobral de Monte Agraço the following day.
After attempting to wait out the enemy, the lack of food and fodder in the area north of the lines forced the French to retreat northwards, starting on the night of 14/15 November 1810.
It was under the command of the German Baron of Eben and of General Brent Spencer, who was on two occasions Wellington's second-in-command.