France, could make a safe withdrawal; and the Anglo-Portuguese forces gained control over Lisbon. The Portuguese populace was free to avenge itself on francophile compatriots for the brutality and depredations of the French. Second invasion As Napoleon began dealing with the Spanish in earnest, he sent Marshal Jean-de-Dieu Soult to reoccupy Portugal. As word spread of the abdication of the Spanish royal family, many Spaniards revolted, gaining support from the British stationed in Portugal. Under the command of John Moore, British forces crossed the northern Portuguese border but were defeated at A Coruña by Marshal Soult, and were forced to retreat in the middle of January. The French immediately occupied northern Portugal and advanced on Oporto by 24 March. Unlike the first invasion, there was a popular revolt against French occupation by farmers, conservative nobility and the poor. Many of the citizen soldiers and farmers fought against the French aggression, going so far as to see tactical retreats as a betrayal or treason by the Portuguese officers. But Soult occupied Chaves on 12 March, a defense of Braga was unsuccessful and the French troops stormed and captured Porto by 29 March. Soult forces encountered a popular resistance in Porto, that included militia and local residents whom barricaded the streets. But Francisco da Silveira recovered Chaves and ultimately, it was Wellesley, again, at the head of the British-Portuguese forces who expelled the French from the north of the country. He was aided by William Carr Beresford and supported by a stronger Portuguese contingent, trained, equipped and commanded by British officers. The Anglo-Portuguese Army defeated Soult at the Second Battle of Porto, re-conquering the city of Porto on 29 May, and forcing the French retreat to Galicia. Wellesley intended to pursue the French, but with French forces crossing from the Spanish Extremadura, he moved his base to Abrantes. From here his forces then marched up the Tagus valley, entered Spain and won the victory at Talavera, after which he was made Duke of Wellington. He could not penetrate further, owing to Soult's forces joining Victor, to bar the way to Madrid, and so withdrew to Torres Vedras to plan for the defense against a third invasion by the French. Meanwhile, in the Portuguese colony of Brazil, Portugal was successful in capturing French Guiana in 1809. Third invasion The third invasion, the last effort of the Peninsular War on Portuguese soil, was commanded