Following the decline of the Roman Empire, in the 5th century AD, the Visigoths came to control the peninsula. Part of the Visigothic legacy to Spanish civilization was the introduction of the institution of monarchy. Several centuries later, in 711, the Visigothic kingdom in Spain was invaded by Muslims. Aside from a nucleus of resistance which was maintained in the north, the Muslim victory was complete by the year 718.
The beginning of the Arab invasion was traditionally described as a conflict between Count Julian of Ceuta and King Rodrigo. Julian, enraged at the seduction of his daughter by King Rodrigo, helped the Arabs enter into Spain. In the end the Arabs did not stop at over-throwing the King, they went on to take over the whole peninsula.
After their invasion in 711, the Arabs established their capital at Cordoba. This choice of location reflected their primary interest in events in North Africa, rather than events in the Christian states of Europe. This focus southward in some ways made it possible for Christian kingdoms to develop in Asturias and the Pyrenees.
Over the centuries the Christian states in northern Spain grew, and slowly began to take over territories to the south. In the 13th century all that was left of the Muslim empire in Spain, or in Al-Andalus as they called it, was the kingdom of Granada. In 1492, Spanish re-conquest of the peninsula was completed when the Arabs lost Granada to King Ferdinand and Queen Isabella.
Over the following centuries, however, the Christian population grew in size and strength. By 950 AD this group had pushed as far south as Leon and Castile. In the 13th century, the Christian kings and nobles had re-conquered all of Spain except Granada. The complete re-conquest was not accomplished until the reign of Ferdinand and Isabella.