During the 5th century the Visigoths rule a large kingdom in southern France and frequently campaign south of the Pyrenees into Spain. In both contexts they are acting as allies of Rome. But in 475 a Visigothic king, Euric, declares his independence and energetically extends his own territory on his own account.

Spain is at first of secondary importance to the Visigoths, compared to France. But in 507 Euric's son is defeated by Clovis, king of the Franks, north of Poitiers. The French territory of the Visigoths is reduced to a coastal strip from the Pyrenees to the Rhône.

During the 6th century the Visigothic territory in Spain is steadily extended. There is a temporary setback in the south from 554, when an army of the Byzantine emperor Justinian captures a region from Cadiz in the west to Cartagena in the east. But within seventy years all the territory has been recovered. During the 7th century the whole of Spain is in the hands of the Visigoths (with their capital at Toledo), though hostilities between rival Visigothic clans, between Visigoths and the indigenous population, and between Arians and Catholics make it a turbulent time.

In 711 one faction, in an internal squabble of this kind, invites an Arab commander to lend support. An Arab army crosses from Africa.

Arabs in Spain and France: 711-732

The short journey across the water from Africa, bringing an army into Spain in 711, begins the final thrust of Arab expansionism in the west. In a frequently repeated pattern of history the invaders, invited to assist one side in a quarrel, rapidly take control and suppress both squabbling parties. Within a few months the Arabs drive the Visigoths from their capital at Toledo.

Soon governors appointed by the caliph in Damascus are ruling much of Spain. The Arabs press on northwards. Their armies move into Gaul, and here at last they are halted - near Poitiers in 732.

Umayyad dynasty in Spain: 756-1031

The defeat of the Arabs in 732 by Charles Martel in Gaul is followed by Berber rebellions in north Africa and in Spain. The effect is to limit Arab territorial ambitions in Europe to the Iberian peninsula. Even this proves hard to hold because of hostilities between rival Arab groups.

Stability in Spain is restored by an Umayyad prince, Abd-al-Rahman, who escapes the Abbasid massacre of his family in Syria. He establishes himself in 756 at Cordoba. Here he founds the first great Muslim civilization of Spain.

Abd-al-Rahman begins the process of making Cordoba one of the outstanding cities of the medieval world. On the site of a Roman temple and Visigothic church he builds the famous mosque, with schools and hospitals attached, which survives today as a place of great beauty - even though its vistas of columns and striped arches are brutally interrupted by alterations made for its later use as the city's cathedral.

Cordoba continues to grow in size and wealth and reputation, known equally for its skilled craftsmen and its scholars. Under Abd-al-Rahman III, in the 10th century, it has probably half a million inhabitants. He is the first amir of Cordoba to accord himself the resounding title of caliph.

During the three centuries of Umayyad rule in Spain the Arabs are for the most part in control of almost the entire peninsula. The Christian reconquest makes several tentative beginnings during the period, but northern territories are often then regained by Arab rulers - relying heavily on the wild Berber mercenaries who form the bulk of their armies.

The Berbers eventually prove too hard to control. Concessions to their demands lead in 1031 to the collapse of the Umayyad caliphate and the effective end of Arab rule in Spain. There follows a period of steady Christian advance southwards. It is halted, in 1086, by a tribal leader from north Africa. He is head of a Berber dynasty, the Almoravids.

The Reconquest:711-1492

The reconquest of Spain has been a dream of the Christians ever since the Muslim conquest in the early 8th century, when the Christian Visigoths are rapidly confined to the tiny kingdom of Asturias in the extreme north. The Reconquista becomes an ideal of medieval Spanish chivalry.

It will take more than seven centuries to complete, until the fall of Granada in 1492, and it is complicated by the high degree of integration which develops in many parts of Spain between Muslims and Christians. The intermingling of the communities reduces tension in the early centuries, but in a later more bigoted age provides rich opportunities for persecution.

There is a corresponding change in the notion of reconquest. At the start the ideal is to restore a united Spain under the kings of the Visigoths. This is a territorial ambition, and in these early centuries the two religions (or three, with the many Jews living in Spain) prosper regardless of whether the ruler of the region is Muslim or Christian.

In the 11th century religious fervour enters both camps. A new Muslim dynasty, that of the Almoravids, is more dogmatic than the Umayyads. A more aggressive Christianity, characteristic of the whole of Europe at this time, affects the northern kingdoms. On the wider stage this is the time of the crusades, and the Christians of Spain have their own local Muslims to confront.

During the many centuries of the Reconquest, the Christian rulers of northern Spain control a frequently squabbling group of small kingdoms. In spite of their mutual antipathies, they gradually coalesce into larger units capable of confronting the Muslims.

The process begins on the north coast, in the 8th century, with the tiny kingdom of Asturias.

Asturias and Galicia:718-910

Visigothic nobles, retreating from the first advance of the Muslims, stop when they can go no further. Reaching the Bay of Biscay, on Spain's northern coast, they withdraw into the region of Asturias - protected by mountain ranges to east, south and west and by the sea to the north. Here they elect a Visigothic prince, by the name of Pelayo, as their king - and dream of reconquering Spain.

The first step in that direction is achieved in the 740s. While the Arabs are distracted by a Berber uprising, in 741, the Asturians annexe Galicia - the coastal region to their west.

In the early 9th century Galicia makes an unexpected but powerful contribution to Christian Spain. Human remains are unearthed and are said to belong to the apostle St James, martyred in Jerusalem but miraculously floated to Spain in a stone coffin. A church built over the spot rapidly becomes a popular place of pilgrimage and the focal point of Christian Spain. The town which grows up around the church is known by the name of St James, Santiago in Spanish. It is Santiago de Compostela.

By the early 10th century the rulers of Asturias control sufficient territory to feel secure in moving their capital from Oviedo to Leon. They call themselves, from 910, the kings of Leon and Asturias.

Catalonia: 785-1150

A small step in the reconquest of Spain from the Muslims is achieved by Charlemagne and the Franks. Gerona is captured in 785 and Barcelona in 801. The region becomes known as the Marcia Hispánica (Spanish march), ruled on behalf of the Franks by a count of Barcelona. The counts continue the reconquest, expanding their territory. By the end of the 10th century they are an independent dynasty ruling Catalonia.

In 1150 the count of Barcelona marries the heiress of Aragon, uniting the regions and ending the identity of a separate Catalonia. But the Catalans, in the northeast extremity of the peninsula, retain a strong sense of independence which has often, in history, resulted in separatist movements.

Leon and Castile: 910-1035

Leon, established from 910 as the centre of a Christian kingdom including Asturias and Galicia, has to its south the high central region of Spain known as Castile. Possibly deriving its name from its profusion of castles, the region is shared by several warring rulers.

From about 950 Castile becomes united under a single count, who makes his capital at Burgos. At first the counts of Castile accept the suzerainty of the kings of Leon, but from 1035 Castile insists on an independent status. Subsequently the two kingdoms are often linked, with Castile increasingly the more powerful. In the dance of the Spanish kingdoms these are established partners, confronting Navarre and Aragon to the east.

Navarre and Aragon: 9th - 12th century

Navarre, at the western end of the Pyrenees, is the homeland of the Basques - a people whose origins are mysterious and whose language is unique in southwestern Europe in not being part of the family of Indo-European languages. They make a famous first showing in history when they ambush the rearguard of Charlemagne's army at Roncesvalles in 788, at the end of his abortive expedition against the Muslims in Spain.

In the 9th century the Basques make their own inroads on Muslim territory, establishing the kingdom of Navarre with their capital at Pamplona. In the early 10th century Sancho III succeeds, for a brief period, in making Navarre the leading Christian kingdom of Spain.

In 1035 Sancho III leaves to one of his sons the small mountain territory of Aragon, with its capital at Jaca, as an independent kingdom. This kingdom, in its turn, expands to the south - incorporating Saragossa by 1118.

The union through marriage of Aragon and Catalonia, in 1150, creates a territorial unit much larger and of greater significance in Spanish history than the parent kingdom of Navarre - which by then is more closely involved with French dynasties north of the Pyrenees.

Castile and Aragon: 1139-1179

By the 12th century the Christian effort against the Muslims is in the hands of three kingdoms which control the northern half of Spain. Portugal, traditionally dating its independent existence from a victory over the Muslims at Ourique in 1139, is on the attack down the west coast. Responsibility for the reconquest of the rest of the peninsula is shared by Castile and Aragon, whose kings sign a treaty at Cazorla in 1179 establishing zones of operation (Aragon is to concentrate on Valencia, on the east coast).

By now the enemy is no longer the Umayyad caliphate of Cordoba. Muslim Spain has been ruled for the past century by more fundamentalist Berber dynasties from the Sahara.

Berber dynasties in Spain: 1086-1248

The end of the Umayyad caliphate in 1031 is followed by a period of anarchy among the Muslims of southern Spain. This gives the Christian kingdoms in the north a welcome opportunity.

In 1085 Alfonso VI of Castile captures Toledo. He follows the Arab example, maintaining the multi-cultural flavour of this civilized city of Muslims, Christians and Jews. He even for a while calls himself 'emperor of the two religions'. But his military successes prompt Muslim rulers further south to enlist the help of the new Almoravid dynasty of Morocco.

The Almoravids - with armies of their own Berber tribesmen - arrive in Spain in 1086 and rapidly overrun the territories recently gained by the Christians. Only on the east coast do they meet their match in the buccaneering El Cid, who captures Valencia in 1094.

Though stricter in religion than the Umayyads, the Almoravid sultans continue the traditions of Muslim Spain; indeed they introduce its architecture to the other half of their empire, in north Africa. But they soon begin to lose control in both regions. The Christian reconquest in Spain begins anew with the capture of Saragossa in 1118. Meanwhile Marrakech, the Almoravid capital in Africa, falls in 1147 to a more puritanical dynasty of Berbers, the Almohads.

The Almohads move rapidly into southern Spain after their defeat of the Almoravids in Morocco. Seville falls to them in 1147, the same year as Marrakech. They make it their Spanish capital, building the Alcázar Palace and the lower part of the Giralda, now the famous belfry of Seville cathedral; in origin it is the minaret of the main Almohad mosque.

The decline of Almohad power, and the decisive phase of the Christian reconquest, begins with the defeat of the Muslims at Las Navas de Tolosa, in 1212, by the combined armies of Castile, Aragon, Navarre and Portugal. Cordoba falls to the Christians in 1236 and Seville in 1248. Meanwhile, in 1238, Aragon recovers Valencia (held by the Muslims since the death of El Cid).

Granada: 1232-1492

After the Christian thrust to the south, between 1212 and 1248, only the southern tip of the peninsula, sheltering among the high mountains of the Sierra Nevada, remains in Muslim hands. It becomes the kingdom of Granada, which lasts for more than two centuries and sees the final flowering of the Muslim culture of Spain.

A Berber noble, linked by descent with the Almoravids, establishes himself in 1232 as the first king of Granada, Muhammad I. In 1246, by which time his kingdom is surrounded by Castilian territory, he makes a treaty of coexistence. He becomes a vassal of the king of Castile and agrees to pay a large annual tribute.

The mountainous territory of Granada is difficult to invade, and the annual tribute (when collected) is of value to the Castilian budget, so Muhammad and his descendants are left relatively free to enjoy a civilized existence. The result is seen in the Alhambra, their palace fortress built between 1238 and 1358; its restful courtyards of Moorish arches and playful fountains now seem the epitome of the Muslim civilization of Spain.

Nevertheless this enclave at the tip of Christian Spain is an affront to the conscience of neighbouring Castile. In the early 15th century the ideal of the Reconquista is revived. By the end of the century Castile, united with Aragon, has the strength to undertake it.