From then on he served Ferdinand of Castile, who entrusted him with the possession of the strengths of Andújar and Martos and subsequently appointed him King's representative in the border fortresses of Andalusia and in the city of Cordoba, which he helped to conquer in 1236. He also commanded the Christian forces which defeated the Muslims at the Battle of Jerez, fought in 1231.