War of the Pyrenees
Under Charles III in 1762 he took part in the Spanish invasion of Portugal and in Gibraltar. In 1793, now under Charles IV, he earned fame for the courage shown in the War of the Pyrenees with Republican France. In 1801 he was commander in chief of the army of Andalucía in the so-called War of the Oranges with Portugal, under the command of Generalissimo Manuel de Godoy.