During the context of the 1383–1385 Portuguese succession crises, the alcalde (against the wishes of its residents) allied with John I of Castile, resulting in an assault by the forces loyal to the Master of Avis (future King John). Óbidos and its castle were transferred to John (following his election by the Cortes in Coimbra as King) by Vasco Gonçalves Teixeira, following the death of his father and former-alcalde, João Gonçalves, in the Battle of Aljubarrota.