Taifa of Valencia

The Taifa of Valencia (طائفة بلنسية) was a medieval Muslim kingdom which existed in and around Valencia, Spain. It gained independence from the Caliphate of Córdoba circa 1010 and became its own small kingdom, or Taifa, for most of the 11th century. It was absorbed by the Taifa of Toledo in 1065, which in turn fell to Alfonso VI of León and Castile in 1085. From 1094 to 1099, the kingdom was ruled directly by the Castilian military commander known as El Cid, then by his wife Jimena after his death, until being annexed by the Almoravids in 1102.

Following the collapse of Almoravid power, Valencia became independent again in 1145. From 1147 to 1172, it was under the control of Ibn Mardanish, after which it was annexed by the Almohads. When the Almohads reatreated from al-Andalus, Valencia became independent once again from around 1229 to 1238 under the rule of Zayyan ibn Mardanish. It was finally conquered by the Crown of Aragon in 1238.

First Taifa period
Valencia was one of many cities in al-Andalus (in present-day Spain and Portugal) that became independent during the Fitna, a destructive civil war after 1008 that ended the Caliphate of Córdoba. As centralized authority collapsed in the caliphate's provinces, local rulers formed their own small states or principalities known to historians as Taifas. Valencia had already enjoyed urban and economic growth since the second half of the 10th century and during the Taifas period of the 11th century it became a major city and political center for the first time since Muslim rule began in 711.

Two  (former slaves) from the Amirid household, called Mubarak and Muzaffar, established the effective independence of Valencia in 1010–1011. They had previously been appointed here as officials in charge of irrigation. Their co-rule ended in 1017–1018, when Mubarak died and Muzaffar was expelled. The people of the city chose another , Labib, as ruler. He accepted the suzerainty of the Count of Barcelona in return for protection.

In around 1021, the kingdom was taken over by 'Abd al-'Aziz, a grandson of the Amirid and former de facto ruler of the caliphate, Ibn Abi Amir al-Mansur (also known as Almanzor). He reigned for 40 years until his death in 1061. During this long period of stability, Valencia enjoyed relative peace and prosperity. 'Abd al-'Aziz employed the same laqab (royal name) as his grandfather and was thus known as al-Mansur.

After his death, he was succeeded by his son 'Abd al-Malik, who took the laqab of al-Muzaffar. Due to his young age, his vizier Ibn 'Abd al-Aziz served as regent. Not long after his accession, Ferdinand I of León and Castile attacked Valencia and defeated an army of its defenders, nearly capturing the city. 'Abd al-Malik turned for aid to al-Ma'mun, the ruler of the Taifa of Toledo, but the latter took the opportunity to seize control of Valencia for himself in 1065. Al-Ma'mun installed his own vizier, Abu Bakr ibn 'Abd al-'Aziz, as governor of the city.

After al-Ma'mun's death in 1075, his less capable son Yahya al-Qadir became ruler of Toledo. Under his rule, Valencia began to slip from Toledo's control and his own kingdom became so troubled that he had to rely on Alfonso VI of Castile and Léon for support. Eventually, the latter took control of Toledo altogether in 1085 and then installed al-Qadir in Valencia as his vassal in 1086.

Capture by El Cid
Al-Qadir's unpopular rule in Valencia was supported by a Castilian garrison headed by Rodrigo Díaz de Vivar, a Castilian noble and mercenary better known today as El Cid. In October 1092, when El Cid was away from the city, there was an insurrection and coup d'état led by the qadi (judge) Abu Ahmad Ja'far Ibn Jahhaf. The latter called for help from the Almoravids, who had recently captured Murcia to the south. They sent a small group of warriors to the city, forcing the Castilian garrison to leave. Al-Qadir was captured and executed.

However, the Almoravids did not send enough forces to oppose El Cid's return and Ibn Jahhaf undermined his popular support by proceeding to install himself as ruler, acting like yet another Taifa king. El Cid began a long siege of the city, completely surrounding it, burning nearby villages, and confiscating the crops of the surrounding countryside. Ibn Jahhaf agreed at one point to pay tribute to El Cid in order to end the siege, which resulted in the Almoravids in the city being escorted out by El Cid's men. For reasons that remain unclear, an Almoravid relief army approached Valencia in September 1093 but then retreated without engaging El Cid. Ibn Jahhaf continued negotiations. In the end, he refused to pay El Cid's tribute and the siege continued. By April 1094, the city was starving and he decided to surrender it shortly after. El Cid re-entered Valencia on 15 June 1094, after 20 months of siege. Rather than ruling through a puppet, as he had done with al-Qadir, he now took direct control as king.

The Almoravids returned their attention to Valencia later that year. They arrived outside the city walls in October 1094 and began a siege. The siege ended when El Cid launched a two-sided attack: he sent a sortie from one city gate that posed as his main force, occupying the Almoravid troops, while he personally led another force from a different city gate and attacked their undefended camp. After his victory, El Cid executed Ibn Jahhaf by burning him alive in public, perhaps in retaliation for treachery.

El Cid fortified his new kingdom by building fortresses along the southern approaches to the city to defend against future Almoravid attacks. In late 1096, an Almoravid army of 30,000 men besieged the strongest of these fortresses, Peña Cadiella (just south of Xativa). El Cid confronted them and called on Aragon for reinforcements. When the reinforcements approached, the Almoravids lifted the siege, but laid a trap for El Cid's forces as they marched back to Valencia. They successfully ambushed the Christians in a narrow pass located between the mountains and the sea, but El Cid managed to rally his troops and repel the Almoravids yet again. In 1097, the Almoravid governor of Xativa, Ali ibn al-Hajj, led another incursion into Valencian territory but was quickly defeated and pursued to Almenara, which El Cid then captured after a three-month siege.

In 1097, the Almoravid ruler himself, Yusuf Ibn Tashfin, led another army into al-Andalus. Setting out from Cordoba with Muhammad ibn al-Hajj as his field commander, he marched against Alfonso VI, who was in Toledo at the time. The Castilians were routed at the Battle of Consuegra. El Cid was not involved, but his son, Diego, was killed in the battle. Soon after, the Castilian commander Alvar Fañez was also defeated near Cuenca in battle with another Almoravid army, who followed up this victory by ravaging the lands around Valencia and defeating another army sent by El Cid. Despite these victories in the field, the Almoravids did not capture any major new towns or fortresses.

El Cid attempted to Christianize Valencia during his rule, converting its main mosque into a church and establishing a bishopric, but ultimately failed to attract many new Christian settlers to the city. He died on 10 July 1099, leaving his wife, Jimena Díaz, in charge of the kingdom. She was unable to hold off Almoravid pressures, which culminated in a siege of the city by the veteran Almoravid commander, Mazdali, in the early spring of 1102. In April–May, Jimena and the Christians who wished to leave the city were evacuated with the help of Alfonso VI. The Almoravids occupied the city after them.

Second Taifa period
As Almoravid authority disintegrated during the 1140s, local communities in al-Andalus once again took matters into their own hands, creating a second wave of Taifa statelets. In Valencia, the Almoravid governor at this time was 'Abd Allah ibn Muhammad ibn Ghaniya (of the Banu Ghaniya family). The local qadi, Marwan ibn 'Abd al-'Aziz, attempted to assuage growing popular hostility towards the Almoravid regime. By March 1145, popular opinion, as well as sentiment among the Andalusi soldiers in particular, was firmly set against the Almoravids and Marwan was pressured into taking leadership of the city under the title of Rais. When he proved unable to keep paying the Andalusi soldiers, they deposed him and installed one of their own leaders, [[Abu Muhammad Abd Allah ibn Iyad
 * Ibd 'Iyad]], as ruler.

In January 1146, Ibn 'Iyad invited Sayf al-Dawla ibn Hud, son of the last Hudid ruler of the former Taifa of Zaragoza, to take command of Valencia and Murcia. Sayf al-Dawla accepted and laid claim to a caliphal title. However, he was killed in a battle with the Christians near Albacete on 5 February. Ibn 'Iyad was killed in August 1147, but before he died he managed to pass the command of Valencia's forces to Muhammad ibn Sa'd ibn Mardanish, known simply as Ibn Mardanish.

Ibn Mardanish made himself ruler of the eastern part of al-Andalus ( or the Levante). He based himself in Murcia and placed Valencia under the governorship of his brother Yusuf. He was vulnerable to Christian forces both to the north and south, but after 1147 the Almohads (who had replaced the Almoravids as the major power in North Africa) presented a more serious threat, having annexed Seville and western al-Andalus. The last Almoravids in al-Andalus remained in Granada until 1155 and the Castilians controlled Almeria until 1157. These two factions acted as buffers between him and the Almohads during this time, but they were eventually expelled by the latter. Ibn Mardanish managed to hold onto to power after this in part by allying himself with Castile, which supplied him with military assistance against the Almohads. Only after he died in 1172 did the Almohads take his kingdom, with little opposition.

Third Taifa period
Although not much is known about the family and descendants of Ibn Mardanish under Almohad rule, they appear to have been integrated into the Almohad elites and maintained some influence in Valencia. Almohad rule in al-Andalus began to collapse after 1212 and the Almohad caliph Idris al-Ma'mun withdrew from the region in 1228. The last Almohad governor of the city, Abu Zayd, was so vulnerable that in 1226 he signed a treaty with James I of Aragon to pay tribute. This made him unpopular and he was overthrown by a rebellion in late 1228 or early 1229. The remaining Almohads departed and it was a descendant of Ibn Mardanish, Zayyan ibn Mardanish, who took control.

Zayyan ibn Mardanish formally acknowledged the Abbasid caliphs in Baghdad as suzerains and remained independent of Ibn Hud, who emerged as the most powerful leader in al-Andalus during this time, but he was unable to halt the advance of Aragonese conquests from the north. As the latter closed in, occupying nearby Puig in 1236, he made a desperate attempt to confront them at the Battle of the Puig (known as the Battle of Anisha in Arabic sources), where he was firmly defeated. James I began the final siege of Valencia on 23 April 1238. Zayyan sent his vizier, Ibn al-Abbar, to Tunis to enlist the aid of the Hafsid dynasty there, but the small fleet subsequently sent by the Hafsids was prevented from landing by Catalan ships. The city surrendered on 29 September. Zayyan was able to retreat and he continued to operate in the region for several more years, even becoming ruler of Murcia from 1239 to 1241. Valencia became part of the Crown of Aragon.

First Taifa period
Saqlabi non-dynastic rulers: Amirid dynasty:
 * Mubarak and Muzaffar: 1010/1–1017/8
 * Labib al-Fata al-Saqlabi: 1017/8–1019
 * Mujāhid al-ʿĀmirī (in Denia 1010/2–1045): 1017–1021, d. 1045, co-ruler in the beginning with Labib
 * Abd al-Aziz al-Mansur: 1021–1061
 * Abd al-Malik ibn Abd al-Aziz al-Muẓaffar: 1061–1065

Dhulnunid dynasty:


 * Al-Mamun of Toledo: 1065–1075 (Valencia annexed to Taifa of Toledo in 1065)

Following the overthrow of al-Qadir:
 * Yahya al-Qadir: 1075–1085 (from Toledo 1075–1085, in Valencia 1086–1092 under Castilian vassalage)


 * Ibn Jahhaf: 1092–1094

Valencia annexed by the Almoravids in 1102.
 * El Cid: 1094–1099
 * Jimena Díaz (wife and successor of El Cid): 1099–1102

Second Taifa period

 * Abu 'Abd al-Malik Marwan: 1145


 * Ibn 'Iyad: 1145–1146


 * Sayf al-Dawla ("Zafadola", of the Hudid dynasty): January–February 1146

Valencia annexed by the Almohads in 1172.
 * Ibn 'Iyad (again): 1146–1147
 * Ibn Mardanish: 1147–1172

Third Taifa period
Valencia annexed by the Crown of Aragon in 1238.
 * Zayyan ibn Mardanish: 1228/9–1238