After the fall of the Caliphate of Córdoba in 1031, Al-Andalus fragmented into a collection of small, independent Taifa emirates. Following the abdication and flight of the last caliph from Córdoba, the city was left without a leader. In response, the prominent citizens appointed Abū 'l Ḥazm Jahwar bin Muḥammad, a notable sheikh from the Banu Jwahar, as their leader. Abū 'l Ḥazm soon established a republican system of government in Córdoba, creating a council of ministers and judicial authorities that he consulted before making political decisions. Unlike the single-emir leadership typical of other taifas, Córdoba under Abū 'l Ḥazm was governed by a "collective leadership." He perceived himself not as an overlord, but as the "Custodian" of Córdoba, dedicated to the city's welfare and its people.
Abū 'l Ḥazm led Córdoba from 1031 until his death in 1043, at which point his son, Abū 'l Walīd Muḥammad, succeeded him. Abū 'l Walīd continued his father's benevolent governance for twenty-one years. As he grew older, he delegated the management of the Taifa to his two sons, 'Abd al-Rāhman and 'Abd al-Malik. The brothers soon began to vie for dominance, undermining the power of the nobles and concentrating authority in their own hands. Eventually, 'Abd al-Malik emerged as the more powerful brother, stripping 'Abd al-Rāhman of his authority. This internal conflict weakened Córdoba, prompting 'Abd al-Malik to seek an alliance with the Emir of Seville, Abbad II al-Mu'tadid.
The alliance between Córdoba and Seville incited the envy of the Emir of Toledo, Yaḥyā bin Dhī 'l-Nūn, who responded by besieging Córdoba and attempting to capture 'Abd al-Malik. Following Abbad II al-Mu'tadid's death in 1069, his successor, Muhammad Ibn Abbad Al Mutamid, seized the opportunity to relieve the siege and subsequently turned his forces against Córdoba. In 1070, after defeating the Toledan army, Al Mutamid captured Córdoba and deposed 'Abd al-Malik, who was first imprisoned and then exiled to the island of Saltés. Seville lost control of Córdoba from 1075 to 1078 but managed to regain and maintain control until the end of their own independence in 1091, marking the end of the taifa.