After the fall of the Umayyad Caliphate in 1031, Al-Andalus had begun to fracture into small, independent Taifa emirates. After the abdication of the last Caliph and his flight from Córdoba, the city was left leaderless. The leading citizens decided to grant power to the most prominent Córdoban sheikh of the Banu Jwahar, Abū 'l Ḥazm Jahwar bin Muḥammad. Abū 'l Ḥazm soon developed a republican system of government in Córdoba with a council of ministers and judiciaries whom he would consult before making every political decision. Under Abū 'l Ḥazm Córdoba was governed by a "collective leadership" and not by a single emir as was common in other taifas. In fact, rather than seeing himself as an overlord of his people, Abū 'l Ḥazm saw himself as the "Custodian" of Córdoba, caring for the city and its inhabitants.
Abū 'l Ḥazm governed Córdoba from 1031 until his death in 1043. He was succeeded by his son Abū 'l Walīd Muḥammad. Abū 'l Walīd continued his father's benevolent rule for twenty-one years. As Abū 'l Walīd grew older, he began to give up management of the Taifa of Córdoba. He instead placed power in the hands of his two sons, 'Abd al-Rāhman and 'Abd al-Malik. The two brothers quickly began to quarrel with each other, stripping the power of the nobles and investing it in themselves in an attempt to gain more power than the other brother. Eventually 'Abd al-Malik gained ascendancy and stripped 'Abd al-Rāhman of all his power. The feud had destabilized Córdoba though, so 'Abd al-Malik began making friendly overtures to the Emir of Seville, Abbad II al-Mu'tadid. The cooperation between Córdoba and Seville aroused the jealousy of the Emir of Toledo Yaḥyā bin Dhī 'l-Nūn, who sent an army to besiege Córdoba and capture 'Abd al-Malik. And after the Sevillian emir Abbad II al-Mu'tadid in 1069, his successor Muhammad Ibn Abbad Al Mutamid seized the opportunity and send an army to lift the siege on Córdoba. In 1070 they defeated the Toledan army, but then turned on Córdoba and captured the city. 'Abd al-Malik was deposed and Al Mutamid took Córdoba for his own taifa. 'Abd al-Malik first was imprisoned, then sent to exile on the island of Saltés. Seville lost control of Cordoba from 1075 to 1078, but then maintained control until the end of their own independence in 1091. This marked the end of the taifa.