The Kingdom of Castile (; , ) was a large and powerful state on the Iberian Peninsula during the Middle Ages. Its name comes from the host of castles constructed in the region. It began in the 9th century as the County of Castile (Condado de Castilla), an eastern frontier lordship of the Kingdom of León. During the 10th century, its counts increased their autonomy, but it was not until 1065 that it was separated from León and became a kingdom in its own right. Between 1072 and 1157, it was again united with León, and after 1230, this union became permanent. Throughout this period, the Castilian kings made extensive conquests in southern Iberia at the expense of the Islamic principalities. The Kingdoms of Castile and of León, with their southern acquisitions, came to be known collectively as the Crown of Castile, a term that also came to encompass overseas expansion. History 9th to 11th centuries: the beginnings According to the chronicles of Alfonso III of Asturias, the first reference to the name "Castile" (Castilla) can be found in a document written during AD 800. In the Al-Andalus chronicles from the Cordoban Caliphate, the oldest sources refer to it as Al-Qila, or "the castled" high plains past the territory of Alava, further south than it and the first encountered in their expeditions from Zaragoza. The name reflects its origin as a march on the eastern frontier of the Kingdom of Asturias, protected by castles, towers, or castra, in a territory formerly called Bardulia. The County of Castile, bordered in the south by the northern reaches of the Spanish Sistema Central mountain system, was just north of modern-day Madrid province. It was re-populated by inhabitants of Cantabria, Asturias, Vasconia and Visigothic and Mozarab origins. It had its own Romance dialect and customary laws. From the first half of the 9th century until the middle of the century, in which it came to be paid more attention, it was administered and defended by the monarchs of Leon, due to the increased incursions from the Emirate of Córdoba. Its first repopulation settlements were led by small abbots and local counts from the other side of the Cantabrian ridge neighbor valleys, Trasmiera and Primorias and smaller ones, from the contiguous maritime valleys of Mena and Encartaciones in nearby Biscay; some of those settlers had abandoned those exposed areas of the Meseta a few decades