Mora was occupied by the Spanish troops in the War of the Two Peters but returned to Aragonese hands in 1364, receiving the privilege of Pedro IV for which it undertook not to separate it from the crown. Such privilege was not taken into account, being the town and castle sold to the Viscount of Cardona, Don Hugo, who, in turn, sold to Don Blasco Fernández de Heredia in 1367. Finally, the lineage of the Fernández de Heredia remained as owner of this population, taking charge of it in 1388 Gil Ruiz de Lihori, who changed his name to Juan Fernández de Heredia. In this locality there was a customs office for the collection of taxes on trade with Valencia.