He participated in many of the major conflicts of the 18th century, including the War of the Polish Succession, the War of the Austrian Succession, the Seven Years' War and the Anglo-Spanish War. His most famous achievement was the successful invasion of Minorca in 1781, in which he defeated a British garrison and returned the island to Spain, although his efforts the following year to recapture Gibraltar from the British were a notable failure. He ended his career in the service of the Spanish Bourbon monarchy, which had been allied with France prior to the French Revolution, and died in Madrid.