The third invasion, the last effort of the Peninsular War on Portuguese soil, was commanded by Marshal André Massena, and divided into three parts under Jean Reynier, Claude Victor-Perrin and Jean-Andoche Junot, and comprised 62,000 men and 84 canon. Entering by way of Beira in August, they quickly defeated the defenders in the Fort of Almeida in August, then marched in the direction of Lisbon. Against the wishes of his council, Messena attacked the Anglo-Portuguese Army on 26 September in Buçaco, losing 4500 troops. Yet, Wellesley's forces withdrew in front of the oncoming French, until his troops entered the prepared positions in Torres Vedras.