Ziri ibn Atiyya (died 1001, Achir) was the tribal leader of the Berber Maghrawa tribal confederacy and kingdom in Fez.
Under the protection of the Umayyad Caliph in Spain, Hisham II, and his powerful regent al-Mansur, Ziri became king of the Zenata tribes in 978-979 and immediately set about conquering as much as he could of what is now known as northern Morocco. In 987-988 he was secure enough to be able to establish his court at Fes after capturing it from the Idrissids[1] In 989, he was asked by al-Mansur to attack Abu al-Bahar, who controlled most of what is now Algeria and Tunisia. Abu al-Bahar had deserted the Fatimid cause to align himself with the Umayyads, but then changed sides again once he had gained control of most of the Maghreb. Ziri attacked with such vigour that Abu al-Bahar fled without much of a fight, and Ziri became master of the Maghreb in the year 991, which led to the annexation of Souss and Zab[2] [3] After this victory, Ziri is said to have sent al-Mansur a present consisting of 200 racehorses, 50 racing camels, 1000 shields, musk civets, giraffes, gazelles and other animals of the Sahara, and 1000 loads of dates. Al-Mansur invited Ziri to Cordoba. He went accompanied by 300 slaves on horseback and 300 more on foot, as well as taking more presents including lions in cages, cattle that resembled horses, a bird that spoke both Arabic and Berber, dates the size of melons, and other prodigies. Al-Mansur gave him the title of vizier. However, on his return to Morocco, Ziri is said to have exclaimed "Now my head is my own!" and forbade anyone to call him by any title other than amir in his absence, the Banu Ifran had managed to capture Fes. They were led by Yaddū, a long-standing adversary of Ziri. After a bloody struggle, Ziri recaptured Fes in 993 and displayed Yaddū's severed head on its walls.[4] [5] [6] the Maghrawa state extended its influence from Fez to Constantine after this[7] Then followed by a period of peace during which time Ziri built (or rebuilt) the city of Oujda beginning in August or September 994.[8] [9] [10] [11] al-Mansur relied on support from the Maghrawa. He often urged Ziri to assist him in his campaigns in Andalusia by providing manpower and financial resources[12] until rumours began to reach al-Mansur that Ziri was ignoring his wishes. At last, in 996, al-Mansur withdrew his support and cancelled his title. Ziri responded by acknowledging Hisham II as rightful Caliph. Al-Mansur then sent an invasion force to Morocco. After three months of struggle, al-Mansur's force had to retreat to the safety of Tangiers. Al-Mansur immediately sent a powerful reinforcement under his son Abd al-Malik. The armies clashed near Tangier. During the battle, Ziri was stabbed by an African soldier who reported to Abd al-Malik that he had seriously wounded the Zenata leader. Abd al-Malik pressed home the advantage, and the wounded Ziri fled the field hotly pursued by the Caliph's army. The inhabitants of Fes would not let him enter the city, but opened the gates to Abd al-Malik on October 13, 998. Ziri fled to the Sahara, where he rallied the Zenata tribes and overthrew the unpopular remnants of the Idrisid dynasty at Tiaret. He was able to expand his territory to include Tlemcen and other parts of western Algeria, this time under Fatimid protection.[13] [14]
Ziri died in Achir, in 1001 of the eventual effects of the stab wounds. He was succeeded by his son al-Mu'izz, who made his peace with al-Mansur, who restored him to possession of all his father's former territories.[15] [16] [17] [18]