In 1809, Wellesley returned to Portugal with fresh forces, and defeated the French at the Second Battle of Porto, driving them from the country. He again advanced into Spain and fought the Battle of Talavera and the Battle of the Côa. He and the Spanish commanders were unable to cooperate, and he retreated into Portugal, where he constructed the defensive Lines of Torres Vedras which protected Lisbon, while he reorganised his Anglo-Portuguese Army into divisions, most of which had two British brigades and one Portuguese brigade.