Nasrid dynasty
The Nasrid dynasty ( banū Naṣr or banū al-Aḥmar; Spanish: Nazarí) was the last Moorish Muslim dynasty in the Iberian Peninsula, ruling the Emirate of Granada from 1230 until 1492. The Nasrid dynasty rose to power after the defeat of the Almohad Caliphate in 1212 at the Battle of Las Navas de Tolosa. Twenty-three emirs ruled Granada from the founding of the dynasty in 1230 by Muhammad I until 2 January 1492, when Muhammad XII surrendered all lands to Queen Isabella I of Castile. Today, the most visible evidence of the Nasrid dynasty is part of the Alhambra palace complex built under their rule.

Background 
The dynasty founded by Muhammad I of Granada held a territory that included Granada, Jaén, Almería, and Málaga. Valencia, Játiva, and Jaén were conquered by Christians during the campaigns of the Reconquista and the Nasrids were made into tribute paying vassals in 1243. Granada continued as a center of Islamic culture. The Nasrids formed alliances with the Marinids of the Maghreb. 

Nasrid crafts like textile work bears the influence of the Berber Almohad Caliphate. Ceramic overglaze used techniques from 9th century Iraq were applied to make lusterware, first in Málaga, Murcia, and Almería, and then by the 15th century in Manises. This style of pottery produced first under Muslim patronage, then Christian, influenced the later style of colorful and glazed Italian ceramics known as maiolica. Throughout the 14th century the Nasrids are noted for their palace architecture like the Alhambra, which was a product of the efforts of Ismail I and Muhammad V.

In 1469 Ferdinand II of Aragon married Isabella I of Castile, uniting the Christian Kingdoms of Castile and Aragon in a common cause dedicated to purging Islam from the Iberian Peninsula. The last Nasrid ruler Muhammad XII of the Emirate of Granada was exiled to the Maghreb in 1492 and the remaining Muslim population was given the status of mudéjar.

Lineage
The Nasrid dynasty was descended from the Arab Banu Khazraj tribe, and claimed direct male-line descent from Sa'd ibn Ubadah, the chief of the tribe and one of the companions of the Islamic prophet Muhammad. The nasab of Yusuf (nicknamed "al-Ahmar", meaning "the Red").

Conflicts of succession and civil war
During the time the Christians were launching a campaign against the Emirate of Granada that would effectively end the Nasrid dynasty, the Nasrids were engaged in a civil war over the throne of Granada. When Abu l-Hasan Ali, Sultan of Granada, was ousted by his son Muhammad XII, Abu l-Hasan Ali retreated to Málaga and civil war broke out between the competing factions. Christians took full advantage of this and continued capturing Muslim strongholds. Muhammed XII was caught by Christian forces in 1483 at Lucena, Córdoba. He was freed after he swore an oath of allegiance to Ferdinand II of Aragon and Isabella I of Castile. Abu l-Hasan Ali finally abdicated in favor of his brother Muhammad XIII, Sultan of Granada, known as Al-Zaghal (the valiant), and a power struggle with Muhammad XII continued. Al-Zaghal prevailed in the inner struggle but was forced to surrender to the Christians. Muhammad XII was given a lordship in the Alpujarras mountains but instead took financial compensation from the Spanish crown to leave the Iberian Peninsula.

Legacy
The Nasrid dynasty was the longest ruling Muslim dynasty in the Iberian Peninsula, reigning for more than 250 years from the establishment of the Emirate of Granada in 1230 to its annexation in 1492. The Nasrids constructed the Alhambra palace-fortress complex in Granada.

Family tree
The family tree below shows the genealogical relationship between each sultan of the Nasrid dynasty. It starts with their common ancestor, Yusuf al-Ahmar. Daughters are omitted, as are sons whose descendants never reigned. During times of rival claims to the throne, the family tree generally recognizes the sultan who controlled the city of Granada itself and the Alhambra palace.

List of Nasrid sultans of Granada

First dynasty (al-dawla al-ghalibiyya):

Abu Abdallah Muhammad I al-Ghalib bi'llah (1238–1273)
Abu Abdallah Muhammad II al-Faqih (1273–1302)
Abu Abdallah Muhammad III al-Makhlu (1302–1309)
Abu'l-Juyush Nasr (1309–1314)

Second dynasty (al-dawla al-isma'iliyya al-nasriyya):

Abu'l-Walid Ismail I (1314–1325)
Abu Abdallah Muhammad IV (1325–1333)
Abu'l-Hajjaj Yusuf I al-Muayyad bi'llah (1333–1354)
Abu Abdallah Muhammad V al-Ghani bi'llah (1354–1359, 1362–1391)
Abu'l-Walid Ismail II (1359–1360)
Abu Abdallah Muhammad VI al-Ghalib bi'llah (1360–1362), known as "The Red King" (el rey Bermejo)
Abu'l-Hajjaj Yusuf II al-Mustaghni bi'llah (1391–1392)
Abu Abdallah Muhammad VII (1392–1408)
Abu'l-Hajjaj Yusuf III al-Nasir li-Din Allah (1408–1417)
Muhammad VIII al-Mutamassik  (1417–1419, 1427–1429), known as "the Little One" (al-Saghir/el Pequeño)
Abu Abdallah Muhammad IX al-Ghalib bi'llah (1419–1427, 1430–1431, 1432–1445, 1447–1453), known as "the Left-Handed" (al-Aysar/el Zurdo)
Abu'l-Hajjaj Yusuf IV (1431–1432), known as Ibn al-Mawl or Abenalmao
Abu Abdallah Muhammad X (1445, 1446–1447), known as "The Lame" (al-Ahnaf/el Cojo)
Yusuf V (1445–1446, 1462), known as Ibn Ismail or Aben Ismael
Muhammad XI (1451–1455), known as "The Little Fellow" (el Chiquito)
Abu Nasr Sa'd al-Mustain bi'llah (1454–1464), known as Ciriza and Muley Zad
Abu'l-Hasan Ali, known as Muley Hacén (1464–1482, 1482–1485)
Abu Abdallah Muhammad XII, known as Boabdil (1482, 1486–1492)
Abu Abdallah Muhammad XIII, known as "The Brave" (al-Zaghal/''el Zagal) (1485–1486)