In 1697, he distinguished himself while defending Barcelona against the French during the Siege of Barcelona at the orders of Prince George of Hesse-Darmstadt. Once the War of the Spanish Succession started, he was created Count of Val de Soto (Conde de Valdesoto) in Spain by Archduke Charles, pretender to the Spanish throne.