He served as Mayordomo mayor and lieutenant of King Alfonso IX of León on several occasions.
In 1225 Álvaro Pérez de Castro, now in the service of the Muslim rules of Jaén, participated with 160 Christian knights in the successful defence of Jaén against an army under Ferdinand III of Castile.
After the siege, Álvaro Pérez de Castro negotiated a truce between Castile and Granada, sealed with the release of 1,300 Christian prisoners.
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.