By the late 600s AD, the Moors, people from North Africa who had converted to Islam, were regularly attacking Visigothic Spain. At first these raids were not very serious, and the Spanish were able to fight them off. But in 711 AD, the Moors took advantage of a civil war in Spain to make a more serious attack, and this time they won. The Moors took over ruling all of Spain, right up into the Basque country in the Pyrenees and into what is now southern France.
The Moors did not control the northernmost parts of this territory for very long, but they did hold on to southern Spain for almost 800 years.
At first, Spain was under the control of the Umayyad caliphs, far away in Damascus. In 750 AD, the only surviving member of the Umayyad family fled from the Abbasids to Spain, where he took over ruling from the local rulers. Naturally he paid no attention to the Abbasid rulers in Baghdad, but declared Spain to be an independent kingdom. He had his capital at Cordoba, where he built many beautiful buildings, including the famous mosque in the picture you see here.
The descendants of the Umayyads ruled Spain for a long time, but in the 1100s the Almohads took over and moved the capital to Seville.
Cool stuff we've been enjoying: Looking for birthday gifts? Check out these new Chromebooks - all the computer you need for only $229.00!. Then study in peace with these Beats wireless headphones - for the exact same price! When you're done, show off your presentation or watch a movie with this excellent smartphone projector for only $39.99!