The Zayyanid dynasty (, Ziyānyūn) or Abd al-Wadids (, Bānu ʿabd āl-Wād) was a Berber Zenata dynasty that ruled the Kingdom of Tlemcen, mainly in modern Algeria centered on the town of Tlemcen in northwest Algeria. The Zayyanid dynasty's rule lasted from 1235 to 1557 History On the collapse of the Almohad Caliphate's rule around 1236, the kingdom of Tlemcen became independent under the rule of the Zayyanids, and Yaghmurasen Ibn Zyan. Ibn Zyan was able to maintain control over the rival Berber groups, and when faced with the outside threat of the Marinids, he formed an alliance with the Sultan of Granada and the King of Castile, Alfonso X. After ibn Zyan's death, the Marinid sultan besieged Tlemcen for eight years and finally captured it in 1337–48, with Abu al-Hasan 'Ali as the new ruler. After a period of self-rule, it was governed again by the Marinid dynasty from 1352 to 1359 under Abu Inan Faris. The Marinids reoccupied it periodically, particularly in 1360 and 1370. In both cases, the Marinids found that they were unable to hold the region against local resistance. but these episodes appear to have marked the beginning of the end of the Zayyanid dynasty. During the rule of Abu Malek the Zayyanids captured Fez and then all of Morocco and installed a ruler as a vassal of Tlemcen, thereby making Morocco a Zayyanid vassal. In the 15th century, expansion eastward was attempted, but proved disastrous, as consequences of these incursions they were so weakened that over the following two centuries, the Zayyanid kingdom was intermittently a vassal of Hafsid Ifriqiya, Marinid Morocco, or Aragon. When the Spanish took the city of Oran from the kingdom in 1509, continuous pressure from the Berbers prompted the Spanish to attempt a counterattack against the city of Tlemcen (1543), which was deemed by the Papacy to be a crusade. The Spanish failed to take the city in the first attack, although the strategic vulnerability of Tlemcen caused the kingdom's weight to shift toward the safer and more heavily fortified corsair base at Algiers. In 1554, the Kingdom of Tlemcen became a protectorate of the Ottoman Empire, which later deposed the Zayyanid dynasty and annexed the country to the Regency of Algiers. List of rulers Dates and most alternate names taken from John Stewart's African States and Rulers (1989). See also Aftasid dynasty Wattasid dynasty List of Sunni Muslim