For the majority of the Middle Ages, Valencia was a constituent part of larger polities. From the time of the Muslim conquest of the Iberian Peninsula, Valencia was controlled by the Umayyad Caliphate in Damascus and the Emirate/Caliphate of Cordoba. Following the latter's collapse, Valencia became the seat of a Taifa state ruled by a succession of local dynasties from 1010 until it was conquered by Rodrigo Díaz de Vivar, El Cid, in 1095. He ruled until his death, when his widow swore fealty to Castile, but was forced out in 1102 and Valencia fell back under the control of a Muslim Caliphate. Again in the 1140s, Caliphate collapse led to the return of local rule, but following four changes of leadership in two years it fell under the control of neighboring Murcia, and later the Almohad Caliphate. A third time, in 1229, Valencia saw almost a decade of local rule before being conquered by Aragon in 1237. Valencia was reorganized into an administrative 'Kingdom of Valencia' within the Crown of Aragon, ruled by Governors appointed by the Aragonese monarch. This arrangement continued until the formal creation of the Crown of Spain and abolition of the previous administrative kingdoms by the Nueva Planta Decrees in 1714. Rulers of Valencia (713-1239) For those who ruled in or over Valencia, see the following pages: 713–1010 : Umayyad Caliphate and Emirate/Caliphate of Córdoba 1010–1095 : First Taifa of Valencia 1095–1099 : El Cid 1099–1102 : Castile 1102–1145 : Almoravids of Morocco 1145–1147 : Second Taifa of Valencia 1147–1172 : Taifa of Murcia 1172–1229 : Almohad Caliphate 1229–1239 : Third Taifa of Valencia Monarchs of Valencia (1239-1707) House of Aragon 1238-1276 : James I the Conqueror, King of Aragon and Count of Barcelona 1276-1285 : Peter I the Great (III of Aragon), son of James I 1285-1291 : Alfons I the Liberal (III of Aragon), son of Peter I/III 1291-1327 : James II the Just, son of Peter I/III 1327-1336 : Alfons II the Kind (IV of Aragon), son of James II 1336-1387 : Peter II the Ceremonious (IV of Aragon), son of Alfonso II/IV 1387-1396 : John I the Hunter, son of Peter II/IV 1396-1410 : Martin the Elder, the Humane or the Ecclesiastic, son of Peter II/IV Martin died without legitimate children. Interregnum 1410-1412 : between the death of Martin the Elder and the Compromise of Caspe. House of Trastámara 1412-1416 :