In the 8th century, the majority of the Iberian Peninsula was occupied by the Muslims who created the kingdom of Al-Andalus. However, in the Cantabrian regions, a small group of Christians who escaped from the Muslim domination created the kingdom of Asturias. On the other hand, in the Pyrenees, the counties integrated in the Marca Hispanica gained their indepedence from the Frankish rule.
From these areas, the Reconquest began. The Reconquest is the military advance towards the south of the Iberian Peninsula between the 8th and the 15th centuries, in which Christians regained territory that had been conquered by the Muslims. In the 11th century the Muslims began to lose territory in favour of the Christian kingdoms but these unit is base on the beginnings of the Reconquest.
THE KINGDOM OF ASTURIAS
During the Muslim conquest some Chrisitan visigoth nobles took refuge in the Cordillera Cantabrica. Among these nobles was Pelayo (Pelagius) who defeated the Muslims in the battle of Covadonga in 722. His successors, Alfonso I and Alfonso II created the kingdom of Asturias. Oviedo was the capital of the Kingdom. Asturian kings extended their dominions into Galicia.
THE KINGDOM OF LEON
In the second half of the 9th century, Alfonso III conquered the territories between the kingdom of Asturias and the Duero river from the emirs of Cordoba. In this way, the kingdom of Asturias became the kingdom of León in 854.
Alfonso III built a defensive line of castles in the western part of the kingdom of Leon to protect the territories from the Muslims. This territory was called Castile.
THE KINDOM OF CASTILE
In the 10th century , Castile was ruled by counts under the control of the King of Leon. Fernan Gonzalez was the count who made Castile independent from the Kingdom of León. Years later, Castile became part of the Kingdom of Pamplona. When Sancho III el Grande died in 1035, his possessions was divided between his sons. So Fernando I made himself king of Castile.