Afterwards, he returned to Spain and served in the Third Carlist War, where he attained the rank of brigadier. He served as captain-general of Navarre after taking part in the 1876 offensive in the valley of Baztan; he acquired his marquessate during this time. He was sent to Cuba as captain-general in April 1879, and was involved in the Little War. He returned to Spain in November 1881 and served as Captain General of Catalonia and Extremadura.