In 1839 he was appointed consul at Rotterdam, and in the following year transferred to Málaga, the ancestral home of his mother's family. In 1842 he was sent to Barcelona, and soon afterwards promoted to the grade of consul general. From 1848 to 1849 he was minister of France at Madrid.