On the opposite side, on the north, the Moslem power had to deal with an even more threatening enemy. The Christians of the Asturias had sprung from very small beginnings, but they were now increasing in strength, and they had the stimulating thought to spur them on, that they were reconquering their own land. When first they had felt the shock of the Moslem invasion, their rout had been utter and complete. They had fled to the mountains of the Asturias, where their trifling numbers and the inaccessibility of their situation gave them safety from the Mohammedan attack. Pelagius, the "old Pelayo" of the ballad, had but thirty men and ten women with him in the cave of Covadonga, which became the refuge of the Gothic Christians; and the Arabs did not think it worth while to hunt down the little remnant of refugees. Here, in the recesses of the cave, which was approached through a long and narrow mountain pass, and entered by a ladder of ninety steps, a handful of men might have set an army at defiance.

The Arab historian[18] thus contemptuously describes the origin of the Christian kingdom: "During Anbasa's administration a despicable barbarian, whose name was Pelayo, rose in the land of Galicia, and, having reproached his countrymen for their ignominious dependence and their cowardly flight, began to stir them up to avenge their past injuries and to expel the Moslems from the land of their fathers. From that moment the Christians of Andalus began to resist the attacks of the Moslems on such districts as had remained in their possession, and to defend their wives and daughters. The commencement of the rebellion happened thus: there remained no city, town, or village in Galicia but what was in the hands of the Moslems, with the exception of a steep mountain on which this Pelayo took refuge with a handful of men; there his followers went on dying through hunger, until he saw their numbers reduced to about thirty men and ten women, having no other food for support than the honey which they gathered in the crevices of the rock which they themselves inhabited like so many bees. However, Pelayo and his men fortified themselves by degrees in the passes of the mountain, until the Moslems were made acquainted with their preparations; but, perceiving how few they were, they heeded not the advice conveyed to them, and allowed them to gather strength, saying, 'What are thirty barbarians, perched up on a rock? They must inevitably die!'" "Would to God!" adds another historian—"Would to God that the Moslems had then extinguished at once the sparks of a fire which was destined to consume the whole dominions of Islam in those parts!"

The little band of refugees was strengthened from time to time by fresh accessions, and, by degrees waxing more confident, came forth from their stronghold, and began to harass the Berbers who formed the frontier settlers. The Moors were at length compelled to seek out the intrepid raiders in their cavern; but the result was discouraging; they were driven back pell-mell with great loss. In 751 Alfonso of Cantabria (where the Moslems had never penetrated), having married the daughter of Pelayo and thus united the Christian forces, roused the northern provinces against the Moors, and, joined by the Galicians of the west, began a series of brilliant campaigns, by which the enemy was driven step by step further south. One after the other the cities of Braga, Porto, Astorga, Leon, Zamora, Ledesma, Salamanca, Saldaña, Segovia, Avila, Osma, Miranda, were recovered from the Moslems, and the Christian frontier was now pushed as far as the great Sierra, and Coimbra, Coria, Talavera, Toledo, Guadalaxara, Tudela, and Pamplona became the Moslem border fortresses. Alfonso had in fact recovered the provinces of Old Castile, Leon, Asturias, and Galicia; but the scanty band of Christians had neither money nor serfs wherewith to build fortifications and cultivate the fields over so immense an area: they contented themselves with leaving the conquered country as a debatable land between them and the Moors, and retired to the districts bordering the Bay of Biscay until such time as their numbers should justify the occupation of a wider area.

In the ninth century they were in a position to advance upon the territory they had already in part recovered from the Moors. They spread over Leon, and built the fortresses of Zamora, San Estevan de Gormaz, Osma, and Simancas, to overawe the enemy. The debatable land was now much narrower, and the hostile forces were almost in contact at various places along the frontier. At the beginning of the tenth century the Moors of the borders made a strenuous effort to regain their lost dominions; but the Christians, aided by the men of Toledo, and by Sancho, King of Navarre, who had become the bulwark of Christianity in the north, defeated them severely, and began to harry the country over the border. The forays of the Christians were a terrible curse to their victims; they were rude, unlettered people, and few of them could even read; their manners were on a par with their education; and their fanaticism and cruelty were what might be expected from such uncouth barbarians. Seldom did the soldiery of Leon give quarter to a defenceless foe, and we may look in vain for the fine chivalry and toleration of the Arabs; where the latter spared nobly, the rough robbers of Leon and Castile massacred whole garrisons, cities full of inhabitants, and those whom they did not slaughter they made slaves.

Abd-er-Rahmān III. had hardly been seated two years on the throne when Ordoño II. of Leon carried a devastating foray to the walls of Merida; and so affrighted were the people of Badajoz that they hastened to conciliate him with blackmail. These cities are not very far from Cordova; only the lofty heights of the Sierra Morena separated the capital of the Omeyyads from the companies of Ordoño. The situation was fraught with danger. The young Sultan, had he been a coward, might have excused himself from instant action on the plea that Merida had not yet recognized his authority, and that it was not his affair if the Christians harried rebellious provinces. This, however, was not Abd-er-Rahmān's policy or temper. He collected his troops and sent an expedition to the north, which made a successful raid into the Christian territories; and the following year, 917, he ordered a second attack. This was defeated with heavy loss by Ordoño before the walls of San Estevar de Gormaz, and the brave Arab general, seeing that the fight was lost, threw himself among the enemy, and died sword in hand. The King of Leon had the pitiful cowardice to nail the head of this gallant soldier to the gate of the fortress, side by side with that of a pig. Encouraged by this success, the armies of Leon and Navarre ravaged the country about Tudela in the following year, but not with equal impunity, for they were twice beaten by the Cordovan troops. Seeing, however, that it took a good deal of defeat to daunt the Christians, Abd-er-Rahmān resolved upon stronger measures. In 920 he took command of the army himself, and by rapid marches and skilful strategy surprised Osma, and razed the fortress to the ground; destroyed San Estevan, which he found deserted by its garrison; and then turned towards Navarre. Twice did he drive Sancho from the field, and when the forces of Navarre were reinforced by those of Leon, and the Christians had the best of the natural position, the Sultan delivered battle with them in the Val de Junqueras (Vale of Reeds), and totally routed their combined array. Incensed by the obstinate defence of the borderers, the Moslems put the garrison of Muez to the sword; and it is unfortunately true that in some of these campaigns the Moors imitated the barbarities of their antagonists, especially when their armies included a considerable admixture of African troops, who were notoriously savage.

Nothing could exceed the heroic determination of the defeated Christians; barbarous they were, but they had the courage of men: routed again and again, they ever rose with fresh heart from the disaster. The very year after the fatal battle in the Valley of Reeds, Ordoño, who was the soul of the Christian resistance, led his men on another raid over the borders; and in 923 Sancho of Navarre, not to be behindhand, recaptured some strong castles. Thus roused once more, the Sultan set out for the north, filled with a stern resolve; he sacked and burned all that came in his way; the cities emptied as he approached, so terrible was the dread he inspired; and he entered the deserted capital of Pamplona, driving Sancho away in confusion as he approached. The cathedral and many of the houses of the capital were ruthlessly destroyed, and Navarre was at his feet. About the same time Ordoño of Leon died, and the civil war which arose between his sons gave the Sultan time to attend to other matters.

On his return from this triumphant campaign, Abd-er-Rahmān III. assumed a new title. Hitherto the rulers of Andalusia had contented themselves with such titles as Emīr (governor), Sultan (dominator), "son of the Khalifs." Although they were the heirs of the Omeyyad Khalifs, and never recognized the Abbāsides who had overturned them, the Andalusian Sultans had not hitherto asserted their claim to the spiritual title: they had considered that the name of Khalif should not be held by those who had no authority over the Holy Cities of Islam, Mekka and Medina, and had been content to leave the Abbāsides in undisputed possession of the name. Now, however, when it was known in Spain that the Abbāside Khalifs no longer exercised any real authority outside the city of Baghdad, and were little better than prisoners even there, in consequence of the growing independence of the various local dynasties, Abd-er-Rahmān, in 929, assumed his title of Khalif with the style of En-Nāsir li-dīni-llāh, "The Defender of the Faith of God."[19]

The Khalif had still thirty years more to reign when he adopted this new name; and they were filled chiefly with wise and cultivated administration at home, and with constant, even annual, expeditions against the Christians, against whom he was indeed a "Defender" of his religion. The civil war, which had for a time neutralized the power of the Leonese, had now given place to the authority of a worthy successor of the great Ordoño. Ramiro II. succeeded in 931, and his warlike character soon asserted itself in resolute opposition to the Khalif's armies. Not long afterwards a formidable league was formed in the north between the Christians and the Arab governor of Zaragoza, and Abd-er-Rahmān hastened to demolish the coalition. In 937 he reduced Zaragoza, and, marching on Navarre, spread such terror around his way that the Queen Regent, Theuda, hastily paid him homage as her suzerain. Ramiro, however, was no party to this surrender. He gathered his men together, and inflicted a tremendous defeat on the Moslems in 939 at Alhandega. Fifty thousand Moors fell upon the field: the Khalif himself barely escaped with his life, and found himself flying through the country with less than fifty horsemen. That disastrous year was long known in Andalusia as the "Year of Alhandega."

Had the Christians pressed their advantage, a different history of Spain would perhaps have had to be written; but, as usual, internecine jealousies among the Christian princes came to the help of the Khalif, and while his foes quarrelled among themselves he repaired his disaster, recruited his army, and made ready for another campaign. The civil war which thus aided him had its origin in the revolt of Castile from the Leonese supremacy. The Count of Castile at this time was the celebrated Fernando Gonzalez, of whom many minstrels have sung. He is one of the great Spanish heroes, and was mated to a heroine. Twice did his wife rescue him from the prison into which he had been cast by his jealous neighbours of Navarre and Leon, and the second time she did it by exchanging clothes with her husband and exposing herself to the fury of his jailers. The earlier occasion was before their marriage, when he was on his way to her father Garcia's court at Navarre, to ask her hand in marriage, and the perfidious king laid hands upon him. A ballad tells the story of his release:

They have carried afar into Navarre the great Count of Castille,
And they have bound him sorely, they have bound him hand and heel....
And there is joy and feasting because that lord is ta'en,
King Garci in his dungeon holds the doughtiest lord in Spain.