Ever since the conquest of the Valley of the Guadalquivir in the 13th century, late medieval Andalusian cities were governed by a small group of families linked to frontier military life, agricultural activities, service to the monarchy and high nobility. The institution of the regiment by Alfonso XI legally sanctioned the oligarchic system, although the closure and the consolidation process of the council elite did not become effective until the second half of the 15th century. The quasi-hereditary transfer of council appointments, the acceptance of aristocratic values and lifestyles, the establishment of the right of primogeniture and the legal recognition of the nobility (well into the 16th century) were the last stages of this drawn-out process of political promotion and consolidation. The Gallegos lineage from Jerez de la Frontera is a good example. They arrived from Galicia in 1269 as settlers and two centuries later they had consolidated their status within the governing elite. At the beginning of the 16th century, Gonzalo Perez Gallegos served the Dukes of Medinaceli, was a part of the town's regiment and played an active role in life on the frontier. In 1527, close to his death, and thanks to the royal licence from Charles I, he sought to guarantee his lineage's position by establishing his right of primogeniture before a public notary.