information:classification
In al-Andalus in the Taifa period

During the Taifa era, the petty kings came from a variety of ethnic groups; some—for instance the Zirid kings of Granada—were of Berber origin. The Taifa period ended when a Berber dynasty—the Moroccan Almoravids—took over al-Andalus; they were succeeded by the Almohad dynasty of Morocco, during which time al-Andalus flourished.

After the fall of Cordoba in 1013, the Saqaliba fled from the city to secure their own fiefdoms. One group of Saqaliba seized Orihuela from its Berber garrison and took control of the entire region.

Among the Berbers who were brought to al-Andalus by al-Mansur were the Zirid family of Sanhaja Berbers. After the fall of Cordoba, the Zirids took over Granada in 1013, forming the Zirid kingdom of Granada. The Saqaliba Khayran, with his own Umayyad figurehead Abd ar-Rahman IV al-Murtada, attempted to seize Granada from the Zirids in 1018, but failed. Khayran then executed Abd ar-Rahman IV. Khayran's son, Zuhayr, also made war on the Zirid kingdom of Granada, but was killed in 1038.

In Cordoba, conflicts continued between the Berber rulers and those of the citizenry who saw themselves as Arab. After being installed as caliph with Berber support, Sulayman was pressured into distributing southern provinces to his Berber allies. The Sanhaja departed from Cordoba at this time. The Zenata Berber Hammudids received the important districts of Ceuta and Algeciras. The Hammudids claimed a family relation to the Idrisids, and thus traced their ancestry to the caliph Ali. In 1016 they rebelled in Ceuta, claiming to be supporting the restoration of Hisham II. They took control of Málaga, then marched on Cordoba, taking it and executing Sulayman and his family. Ali ibn Hammud al-Nasir declared himself caliph, a position he held for two years.

For some years, Hammudids and Umayyads fought one another and the caliphate passed between them several times. Hammudids also fought among themselves. The last Hammudid caliph reigned until 1027. The Hammudids were then expelled from Cordoba, where there was still a great deal of anti-Berber sentiment. The Hammudids remained in Málaga until expelled by the Zirids in 1056. The Zirids of Granada controlled Málaga until 1073, after which separate Zirid kings retained control over the taifas of Granada and Malaga until the Almoravid conquest.

During the taifa period, the Aftasid dynasty, based in Badajoz, controlled a large territory centered on the Guadiana River valley. The area of Aftasid control was very large, stretching from the Sierra Morena and the taifas of Mértola and Silves in the south, to the Campo de Calatrava in the west, the Montes de Toledo in the northwest, and nearly as far as Oporto in the northeast.

According to Bernard Reilly, during the taifa period genealogy continued to be an obsession of the upper classes in al-Andalus. Most wanted to trace their lineage back to the Syrian and Yemeni Arabs who accompanied the invasion. In contrast, tracing descent from the Berbers who came with the same invasion "was to be stigmatized as of inferior birth". Reilly notes, however, that in practice the two groups had by the 11th century become almost indistinguishable: "both groups gradually ceased to be distinguishable parts of the Muslim population, except when one of them actually ruled a taifa, in which case his low origins were well publicized by his rivals".

Nevertheless, distinctions between Arab, Berber, and slave were not the stuff of serious politics, either within or between the taifas. It was the individual family that was the unit of political activity." The Berber that arrived towards the end of the caliphate as mercenary forces, says Reilly, amounted to only about 20 thousand people in a total al-Andalusi population of six million. Their high visibility was due to their foundation of taifa dynasties rather than large numbers.

In the power hierarchy, Berbers were situated between the Arabic aristocracy and the Muladi populace. Ethnic rivalry was one of the most important factors driving Andalusi politics. Berbers made up as much as 20% of the population of the occupied territory.