Maghrawa

The Maghrawa or Meghrawa (المغراويون) were a large Zenata Berber tribal confederation whose cradle and seat of power was the territory located on the Chlef in the north-western part of today's Algeria, bounded by the Ouarsenis to the south, the Mediterranean Sea to the north and Tlemcen to the west. They ruled these areas on behalf of the Umayyad Caliphate of Cordoba at the end of the 10th century and during the first half of the 11th century.

Origins
The Maghrawa descend from Madghis (Medghassen ). The Maghrawa are related to the Banu Ifran and the Irnyan. Several tribes descend from the Maghrawa, including the Bani bou Said, Bani Ilit (Ilent), Bani Zendak, Bani Urac (Urtezmir, Urtesminn), Bani Urcifan, Bani Laghouat, Bani Righa, Bani Sidi Mansour (Bani Mansour), A. Lahsen, etc.

Maghra means "someone who has sold his share" but also "old" in Berber. Its plural form is Aimgharen. The name Maghrawa is also used in literary Arabic, by writers such as Ibn Khaldun, the 14th-century historian of the Maghreb.

Around the beginning of the first century the Maghrawa were very numerous around Icosium, now part of Algiers but then subject to Roman client kings of Mauretania. As a security measure, Ptolemy of Mauretania relocated some of the Maghrawa people to the Chlef region. The Maghrawa occupied the region between the cities of Tlemcen and Ténès at the time of the early Muslim conquests. Most of the inhabitants of the Aurès are from this ancient tribe and the Ouarsenis is also home to the Maghrawas. The Blidéen Atlas, the Dahra Range in Tipaza, Mostaganem, Mazouna, Algiers, Cherchel, Ténès, the Chélif, Miliana and Médéa were the territory of the Maghrawa since Numidian times.

Among the tribes of Maghrawa ancestry and masters of the Western Dahra in the nineteenth century were the Achaachas, the Zerrifas, the Ouled Khellouf (where the mausoleum of the marabout Sidi Lakhdar is located), the Beni Zeroual and the Mediounas, most of them communes of the wilaya of Mostaganem.

Origins and early history
The confederation of Maghrawa were the majority people of the central Maghreb among the Zenata (Gaetuli). Both nomadic and sedentary, the Maghrawa lived under the command of Maghrawa chiefs or Zenata. Algiers has been the territory of the Maghrawa since ancient times. The name Maghrawa was transcribed into Greek by historians. The great kingdom of the Maghrawa was located between Algiers, Cherchell, Ténès, Chlef, Miliana and Médéa. The Maghrawa imposed their domination in the Aurès. Chlef and its surroundings were populated by the Maghrawa according to Ibn Khaldun. The Maghrawa settled and extended their domination throughout the Dahra and beyond Miliana to the Tafna wadi near Tlemcen, and were found as far away as Mali.

The Maghrawa were one of the first Berber tribes to submit to Islam in the 7th century. They supported Uqba ibn Nafi in his campaign to the Atlantic in 683. The Maghrawa were initially led by the Banu Khazar family who lived in the first half of the 8th century and took control of a large part of the central Maghreb after the Kharijite revolts (circa 740). The Maghrawa role in the Kharijite revolt is known only from a tradition quoted by Ibn Khaldun and is not mentioned in any Arabic sources. His son, Muhammad ibn Khazar, defeated the Banu Ifran and captured Tlemcen circa 788, before submitting to the Idrisids sometime between 789 and 791 and becoming their ally. The latter's grandson, also named Muhammad ibn Khazar, allied himself with the Umayyads of Córdoba in Al-Andalus (present-day Spain and Portugal) and resisted the Fatimids for most of his life, embroiling the Maghrawa in the conflict between these two powers that played out in present-day Morocco and Algeria. Over the following decades, the two sides both suffered various victories and reversals. Muhammad ibn Khazar himself switched allegiances several times when the circumstances required, although his son al-Khayr, who also held territories in the central Maghreb, remained largely loyal to the Umayyads. Muhammad ibn Khazar eventually died in 961, reportedly over a hundred years old.

After his death, the Maghrawa continued to resist the Fatimids under the leadership of his grandson, Muhammad ibn al-Khay, son of al-Khayr. The latter had previously cultivated good relations with Abd ar-Rahman III (d. 961), the Umayyad caliph in Córdoba, who had appointed him governor of Fez in 955–6. He continued to serve Abd ar-Rahman III's successor, al-Hakam II (d. 976). In 971, a major confrontation took place between the Maghrawa and the Zirids, a Sanhaja clan led by Ziri ibn Manad, vassal of the Fatimids. In February 971, most likely near Tlemcen, the Maghrawa were severely defeated. Muhammad ibn al-Khayr committed suicide to avoid capture. His son, al-Khayr, took up the leadership role and allied himself with a Fatimid governor, Ja'far ibn 'Ali ibn Ḥamdun, who defected to the Umayyad side. With their combined forces, they won a major victory. Pressured by another Fatimid army, however, the majority of the Maghrawa left the central Maghreb and migrated into the Maghreb al-Aqsa (present-day Morocco), where they settled across the region.

In the western Maghreb
In 976–7, a Maghrawa chief named Khazrun ibn Fulful ibn Khazar conquered Sijilmasa from the Banu Midrar, and in 980 were able to drive the Miknasa out of Sijilmasa as well. Khazrun sent the head of the last Midrarid ruler to Córdoba, whose rulers subsequently appointed him and his descendants, the Banu Khazrun, governors of Sijilmasa on behalf of the Umayyads.

Other branches of the Maghrawa founded small kingdoms or principalities in the region around the same period. One branch of the family descended from the Banu Khazar settled in Aghmat to the south, ruling there until the Almoravid conquest circa 1059. Another descendant of the Banu Khazar, identified as Muqatil, established himself in the Sous valley. Very little is known about either of these two branches.

Between 979 and 983, the Zenata were briefly driven out of Fez, Sijilmasa, and much of the surrounding regions during a major expedition by Buluggin ibn Ziri, the new Zirid ruler.

The Maghrawa reached their peak under Ziri ibn Atiyya (d. 1001), who achieved supremacy in Fez under Umayyad suzerainty, and expanded their territory at the expense of the Banu Ifran in the northern Maghreb – whose alliances had shifted often between the Fatimids and the Umayyads of Córdoba. Ziri ibn Atiyya conquered as much as he could of what is now northern Morocco and was able to achieve supremacy in Fez by 987. In that same year, Ibn Abi 'Amir al-Mansur – the regent of Caliph Hisham II and de facto ruler of the Caliphate of Córdoba – formally appointed Ziri as amir of the Maghreb on his behalf. Fez became his capital and generally remained under the control of his successors until the Almoravid conquest of the 11th century.

In 989, Ziri defeated his enemy Abu al-Bahār, which made him ruler from the Zab to the Sous, achieving supremacy in the western Maghreb by 991. In 993, he was invited to Córdoba by Ibn Abi 'Amir al-Mansur. Ziri brought many gifts and al-Mansur housed him in a lavish palace, but Ziri soon returned to North Africa. Meanwhile, his rival from the Banu Ifran, Yaddū ibn Ya'lā, had taken advantage of his absence and managed to capture Fez, which Ziri reconquered after a bloody struggle. A period of peace followed, in which Ziri founded the city of Oujda in 994 and made it his new capital and fortress. He likely intended to expand his power to the central Maghreb and the position of Oujda, further west, was more appropriate for this goal than Fez.

However, Ziri was loyal to the Umayyad caliphs in Cordoba and increasingly resented the way that Ibn Abi 'Amir was holding Hisham II captive while progressively usurping his power. In 997, Ziri rejected Ibn Abi 'Amir's authority and declared himself a direct supporter of Caliph Hisham II. Ibn Abi 'Amir sent an invasion force to Morocco. After three unsuccessful months, Ibn Abi 'Amir's army was forced to retreat to the safety of Tangiers, so Ibn Abi 'Amir sent a powerful reinforcements under his son Abd al-Malik. The armies clashed near Tangiers, and in this 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, hotly pursued by the Caliph's army. The inhabitants of Fez would not let him enter the city, but opened the gates to Abd al-Malik on 13 October 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. Ziri died in 1001 of the after-effects of the stab wounds.

After Ziri's death, his son al-Mu'izz was proclaimed his successor as leader of the Maghrawa in northern Morocco. He did not share his father's hostility to Córdoba and al-Mansur had already appointed him governor of Fez on behalf of the Umayyads in 999–1000. Al-Mansur's son and successor, Abd al-Malik al-Muzaffar, confirmed him as governor of Fez and the Maghreb al-Aqsa in 1002–3 and again in 1006, with the exception of Sijilmasa, which was left under the rule of the Banu Khazrun. Al-Mu'izz's reign in Fez marked a period of relative peace. He also managed to remove Zirid rule in Tlemcen, where he installed one of his relatives, Ya'la (a descendant of al-Khayr), as governor. Ya'la's descendants continued to rule Tlemcen after him, though remaining loyal to al-Mu'izz.

Al-Mu'izz died in 1026 or 1030 and was succeeded by his paternal cousin, Hamama ibn al-Mu'izz ibn 'Atiya. Al-Mu'izz had already appointed the latter as governor of Fez before his death. Hamama strengthened his relations with Córdoba but in 1032–3 he became embroiled in war with the rival Banu Ifran leader, Abu al-Kamal Tamim ibn Ziri, based in Chellah. Abu al-Kamal Tamim captured Fez, forcing Hamama to flee east to Oujda and Ténès. In 1037–8, after gathering new forces, Hamama expelled the Banu Ifran and reclaimed Fez. In 1038–9, he attacked the Hammadids, a Sanhaja dynasty related to the Zirids. The Hammadid ruler, al-Qa'id, met with Hamama and paid the Maghrawa troops to defect. Hamama, fearing the outcome, fled back to Fez and declared his submission to al-Qa'id. He died sometime between 1039 and 1042.

He was succeeded by his son Dunas, who spent much of his reign improving the city of Fez, whose commercial importance was growing. After his death in 1059, his son al-Futuḥ succeeded him but the succession was contested by his brother Ajisa. The two brothers each took control of different parts of Fez and warred with each other for three years, until al-Futuḥ emerged victorious in 1062. Al-Futuḥ only ruled briefly, being driven from Fez in that same year by the Hammadid ruler Buluggin ibn Muhammad, who briefly occupied the city. After this, the Maghrawa appointed one of Ziri ibn Atiyya's descendants, Mu'annaṣir (or Mu'anṣar), as ruler.

By the mid 11th century, the Maghrawa still controlled most of Morocco, notably most of the Sous and Draa River area as well as Aghmat, Fez and Sijilmasa. As the Almoravids expanded northward during this period, the Maghrawa were their main opponents in this region. As Zenata power declined, the leaders of the Magharawa and Banu Ifran became more oppressive and violent, with some historical chronicles claiming that the local population welcomed the arrival of the Almoravids. The latter eventually overcame the Zenata rulers in the western Maghreb during the second half of the 11th century. Varying sources date their capture of Fez to 1069 or some time later in the 1070s. Mu'annaṣir, the last Maghrawa ruler of Fez, attempted to resist the Almoravid siege of the city but died in the process. His son Tamim was appointed to replace him but he was executed when the Almoravids captured the city soon after. Many of the Maghrawa and other Zenata in the city were slaughtered in the aftermath. The remaining Maghrawa fled east and north, until the Almoravids expanded in these directions as well.

Meanwhile, in Tlemcen, the descendants of Ya'la had cultivated friendly relations with the Hammadids during the early 11th century. This allowed them to rule an effectively independent kingdom until the 1050s, when they came into conflict with some of the Banu Hilal tribes arriving from the east, who took over much of the countryside. The Maghrawa amir at this time, Bakhti, rallied the other Zanata tribes in the region and fought a prolonged war with the Zughba, one of the Hilalian tribes, who allied themselves with the Hammadids. Bakhti died at some point during this period and was succeeded by his son al-Abbas, who held onto Tlemcen until the Almoravids arrived. The latter captured the town towards 1080, executing al-Abbas and killing many of the Maghrawa inside the city.

Later history
Despite the Almoravid conquest, various groups of Maghrawa continued to live in various parts of Morocco until at least the 14th century, when they are mentioned by sources such as Ibn Khaldun. Additionally, the minority of Maghrawa tribes who had not left the central Maghreb with al-Khayr ibn Muhammad ibn al-Khayr after 971 remained in the Chélif region, even under Almoravid rule. They became important again for a time during the 14th century, when their main city was Timzaghat (or Timzurat). They unsuccessfully attempted to throw off the authority of the Zayyanid sultans in Tlemcen on several occasions around the mid-century until their final defeat in 1372, after which many of them left the region.

Maghrawa society
The Zenata seized some of the best lands of the Masmuda, and the Maghrawa became the dominant military caste over those they conquered.

According to Ibn Abi Zar, the chronicler of Fez, the Maghrawa improved the walls, gates and mosques of Fez, and under their rule, the city enjoyed peace. Its people were busy with construction activities and the town expanded. Security and prosperity continued up until shortly before the arrival of the Almoravids. Overall, the mass migration of the Banu Ifran and Maghrawa because of the Sanhaja expansion caused political and ethnic revolution in Morocco.

Maghrawid leaders
The Maghrawa were led by the Banu Khazar family, named after Khazar ibn Ḥafṣ ibn Ṣulat ibn Wazmār ibn Maghraw, who lived in the first half of the 8th century. His son, Muhammad ibn Khazar, continued to lead after him. Muhammad's son, named Khazar like his grandfather, had a son who was also named Muhammad and was thus also known as Muhammad ibn Khazar. The latter died in 961, reportedly over a hundred years old. He had three sons from whom many future Maghrawa leaders descended: Falful, al-Khayr, and Hamza.

Starting with Ziri Ibn Atiyya, the Maghrawa dynasty that ruled Fez and the surrounding region consisted of two family branches descended from the sons of Atiya. Atiya was a descendant of Muhammad Ibn Khazar via his son Falful. One branch descended from Ziri ibn Atiya and the other from his brother, Al-Mu'izz ibn Atiya. The rulers are listed here in chronological order: Tamim was the last Maghrawa ruler to hold power before the Almoravids took over Fez. There is uncertainty about the chronology of Almoravid conquests in this region and therefore different authors give different dates for the Almoravid conquest of Fez.
 * Ziri ibn Atiyya, r. 988–1001.
 * al-Mu'izz ibn Ziri, r. 1001–1026. (Another source also claims he died in 1030 instead. )
 * Hammama ibn al-Mu'izz (son of al-Mu'izz ibn Atiya and cousin of al-Mu'izz ibn Ziri), r. 1026–1039. (He may also have died as late as 1042 instead. )
 * Abu al-Attaf Dunas ibn Hamama, r. 1039–1059.
 * Hammad ibn al-Mu'izz (son of al-Mu'izz ibn Ziri), challenged Abu al-Attaf Dunas and died in 1043.
 * Futuh ibn Dunas, r. 1059–1062.
 * Ajisa ibn Dunas (Futuh's brother), who controlled a part of Fez, fought with his brother and was killed by him in 1061.
 * Mu'annasir ibn Hammad (descended from Ziri's line), r. 1062–1067.
 * Tamim, r. 1067–1069.