Toledo had been the capital of the Visigothic Kingdom shattered by the Islamic conquest of Iberia in the 8th century. Despite the capital of Al Andalus being moved to Córdoba, in succeeding centuries Toledo kept a strategic importance as capital of the "Middle March", maintaining a relative autonomy under the Umayyad caliphate of Córdoba in spite of repeated rebellion. As the caliphate inevitably failed, the ensuing civil wars of the early 11th century allowed Toledo increasing autonomy. Power remained in the hands of local leaders, including Abu Bala Ya'is ibn Mubammad, Ibn Masarra, Abd al-Rahman and Abd al-Malik ibn Matiyo. These Toledans offered the city to the lord of
Santaver (Santabariyya), Abd al-Rahman ibn Dil-Nun, who, around 1035, sent his son Ismail al-Zahir to Toledo to take control.
The Banu Dil-Nun (from Banu Zenun) were a family of the Berber tribe Hawwara, that had arrived in the peninsula during the Islamic conquest. They settled in the area of Santaver in the 8th to the 10th centuries. Throughout that time Banu Dil-Nun kept on rising up against the Emirate. They regained their autonomy with the decline of the Caliphate during the first decade of the eleventh century: then, possibly, Abd al-Rahman ibn Dil-Nun was made the lord of Santaver, Huete, Uclés and Cuenca obtained by Caliph Sulayman al-Hakam (1009–10 and 1013–16), carrying the title of "Nasir al-Dawla". Abd al-Rahman entrusted his son Ismail with government of Uclés in 1018.
The territory of the taifa of Toledo eventually became the more durable Kingdom of Toledo; at its largest extent the taifa controlled land now apportioned between the Spanish provinces of Toledo, Ciudad Real, Cuenca, the northern part of Albacete, Cáceres, Guadalajara (to the frontier with the taifa of Zaragoza in Medinaceli) and Madrid (to the Sierra de Guadarrama).
The disintegration of the taifa of Toledo occurred piecemeal over a number of years. Ismail al-Zahir held the throne until 1043, fighting for his independence against Córdoba. He was succeeded by Al-Mamun, who asked Ferdinand I of León and Castile for assistance against Al-Mustain I of the taifa of Zaragoza; twenty years later Toledo was attacked by Ferdinand himself, and was forced to pay tribute to escape the menace. When in 1061 Abd al-Malik ben Abd al-Aziz al-Mansur, ruler of the taifa of Valencia, was attacked by Ferdinand, he sued for support from Al-Mamun, but the latter took advantage of the situation to annex Valencia (1064) with the approval of the Christian king.
The taifa of Toledo and the taifa of Seville both aimed to annex the former capital of Córdoba to their lands; this ended with the city being captured by Seville in 1070. The new King of León, Alfonso VI, pursued a policy of playing the Muslim rulers against each other for his benefit. With the help of al-Mu'tamid of Seville he defeated Abdallah ibn Buluggin of Granada, but at the same time helped Al-Mamun of Toledo in conquering the taifa of Córdoba in 1075. At this point Al-Mamun was the most powerful lord of southern Iberia, his lands including Toledo, Córdoba and Valencia, but he was poisoned the same year, being succeeded by his grandchild
Al-Qadir of Toledo.
Al-Qadir expelled the exponents of the pro-Castilian party from Toledo causing a revolt in Valencia, which proclaimed its independence. The Cordoban lands were lost in 1077, as well as the southernmost provinces of the kingdom, and Al-Qadir also found himself attacked by
Al-Mutawakkil of the taifa of Badajoz. He was therefore forced to ask again for help from Castile, in this way losing the support of many of his subjects. Al-Mutawakkil occupied Toledo in 1080, while Al-Qadir took refuge in Cuenca. He was able to regain the throne the following year, the agreement including the acquisition of Toledo by the Castilian kingdom, while al-Qadir would keep ruling Valencia. Much of the population, tired by the endless series of wars, accepted Alfonso's entrance into Toledo (though with a simulated siege in order to escape a loss of prestige in the Muslim world), but a faction solicited an alliance between Al-Muqtadir of Zaragoza, Al-Mu'tamid of Seville and Al-Mutawakkil of Badajoz against Alfonso. The latter responded by attacking his enemies and, after four years of "siege", Toledo officially and peacefully fell into Christian hands on 6 May 1085.