Shortly after the battle of Aljubarrota, John was released. He and his new wife were created lord and lady of Alba de Tormes in 1385 by the King of Castile (his brother-in-law). In the summer of 1386, he was commissioned to defend Andalusia from Portuguese attacks. Later in the year, when John of Gaunt (uncle of the English king Richard II) invaded northern Castile to try to claim the throne for himself, Infante John made a series of incursions into Portuguese territory, but failed to garner significant support for his own pretensions to the Portuguese crown. For his loyalty to Castile, in 1387 John was created duke of Valencia de Campos (renamed Valencia de Don Juan in his honor), a rank which adjoined him to the upper echelons of Castilian nobility. Castile's truces with England and Portugal from 1388 onwards seem to have eclipsed Duke John from any significant political role, and he kept a relatively low profile until his death.