Assigned to Spain, he commanded a dragoon brigade under Marshal Jean Lannes. On 23 November 1808, he fought in the Battle of Tudela where Francisco Castaños was defeated. Appointed in 1812 the civilian and military governor of the provinces of Córdoba and Jaén, he managed by a wise administration, to win the trust of people that the ravages of war had angered and reduced to the deepest misery. For six months, he kept over 7,000 people from suffering famine.