Black Guard

The Black Guard or ‘Abid al-Bukhari (عبيد البخاري; also known as ‘Abīd al-Dīwān "slaves of the diwan", Jaysh al-‘Abīd "the slave army", and ‘Abid al-Sultan "the sultan’s slaves") were the corps of black-African slaves and Haratin slave-soldiers assembled by the 'Alawi sultan of Morocco, Isma‘il ibn Sharif (reigned 1672–1727). They were called the "Slaves of Bukhari" because Sultan Isma‘il emphasized the importance of the teachings of the famous imam Muhammad al-Bukhari, going so far as to give the leaders of the army copies of his book. This military corps, which was loyal only to the sultan, was one of the pillars of Isma'il's power as he sought to establish a more stable and more absolute authority over Morocco.

After Isma'il's death, the Black Guard became one of the most powerful factions in Moroccan politics and played the role of kingmakers during the period of turmoil that followed. Over the course of the later 18th century and the 19th century their role in the military was progressively reduced and their political status varied between privilege and marginalization. Their descendants eventually regained their freedom and resettled across the country. While black Africans lived in the region long before Isma'il's reign, a long-term consequence of his policies was the introduction and eventual dispersal of a substantial new black population in Morocco.

Composition and training
The Black Guard descended from black captives brought to Morocco from West Africa, who were settled with their families in special colonies, at Mashra' al-Raml, to have children and to work as indentured servants. At age 10, children began to be trained in certain skills: the girls in domestic life or entertainments, and the boys in masonry, archery, horsemanship, and musketry. Around the age of 16 (on average), the boys who passed their training were enlisted into the army. (Some authors cite the ages of 15 or 18. ) They would marry, have children, and continue the cycle. Considered more loyal than the local Arabs or Berbers because of their lack of tribal affiliation, Isma‘il's black soldiers formed the bulk of his standing army and numbered 150,000 at their peak.

According to historical sources, Isma'il would declare to his black soldiers and their chiefs that "You and I are now servants of the Sunna of the Prophet Muhammad". To this end, he gave them copies of Sahih al-Bukhari by Muhammad al-Bukhari, a famous compilation of the hadiths ("discourses" or traditions) of Muhammad, and instructed them to keep and study it. They were required to swear their oaths to the sultan upon this book, and even encouraged to take their copies of it into battle. This was the origin of their popular designation as the  'Abid al-Bukhari or "Slaves of al-Bukhari".

Isma'il's reign
Isma'il, or Moulay Isma'il, ruled as sultan for 55 years between 1672 and 1727, one of longest reigns in Moroccan history. Ruling from a new capital at Meknes, he distinguished himself as a ruler who wished to establish a unified Moroccan state as the absolute authority in the land, independent of any particular group within Morocco – in contrast to previous dynasties which relied on certain tribes or regions as the base of their power. He succeeded in part by creating a new army composed of slaves whose loyalty would be to him alone. In 1699, he gave orders to enslave all black Africans in Morocco, even those who were born free or who were Muslim, and, consequently, he violated two of the central tenets of Islamic law concerning slavery. Moroccan registers show that Isma‘il enslaved over 221,000 black Moroccans between 1699 and 1705. In a study of these events, scholar Chouki El Hamel argues that Isma'il's efforts to justify these actions generated a potent new form of racist discourse in the region that associated black Africans with slavery. The idea of a professional army composed of slaves who were loyal only to the sultan was inspired by the historical precedents of other Middle Eastern and North African military bodies recruited from slaves. Isma'il's army was inspired in particular by the example of the Janissaries in the Ottoman Empire, to which it is sometimes compared.

The ‘Abid al-Bukhari or Black Guard or were mainly in charge of collecting taxes and patrolling Morocco's unstable countryside; they crushed rebellions against Isma‘il's rule not only by dissident tribes but also by Isma‘il's seditious sons, who defected from service as his provincial governors to insurrection as would-be usurpers of his throne. The Black Guard were the personal guard and servants of Sultan Isma‘il, they might have also participated in campaigns against the European-controlled fortress enclaves dotting his empire's coast (such as Tangier, taken over after the English withdrew from it and distressed it in 1684 in response), although tasks of this kind were often allocated to European slaves (called ‘aluj العلوج, plural of ‘alj, meaning "white Christian slave") and loyal Moroccan tribal soldiers, considered more military and cavalry-able. They were well-respected, well paid, and politically powerful. Around 1697-1698 they were even given the right to possess property.

After Isma'il's death
After Isma‘il's death in 1727, the ‘Abid played a key role in the political turmoil that engulfed Morocco, frequently shifting allegiance between different claimants to the throne. The turmoil lasted mostly between 1727 and 1757, when Isma'il's sons fought for control of the sultanate, with few of them ever holding onto power for long. The  'Abid of Isma'il's reign came to wield enormous power and were able to install or depose sultans according to their interests throughout this period, though they also had to compete with the guich tribes and some of the Amazigh (Berber) tribes that the sultans also relied on. Abdallah, one of the most successful rulers during this conflicted period, was initially supported by the  'Abid but eventually made enemies of them after 1733. Eventually he was able to gain advantage over them by forming an alliance with the Amazigh tribe of Ait Idrasin, the Oudaya guich tribe, and the leaders of Fez. This alliance steadily wore down the  'Abid 's power and paved the way for their submission in the later part of the 18th century. The military quality of the ‘Abid also went downhill over time, as they were no longer paid as well. Some became brigands, others quit and moved to the cities. Subsequent leaders attempted and some succeeded in resurrecting the group. However, they were never as formidable as they were in Isma‘il's time.

Order was more firmly re-established in Morocco under Abdallah's son, Mohammed ibn Abdallah (Mohammed III), who became sultan in 1757. Many of the  'Abid had by then deserted their contingents and joined the common population of the country, and Mohammed III was able to reorganize those who remained into his own elite military corps. Later, in 1775, he tried to distance the  'Abid from power by ordering their transfer from Meknes to Tangier in the north. The  'Abid resisted him and attempted to proclaim his son Yazid (the later Moulay Yazid) as sultan, but the latter soon changed his mind and was reconciled with his father. After this, Mohammed III dispersed the  'Abid contingents to garrisons in Tangier, Larache, Rabat, Marrakesh and the Sous, where they continued to cause trouble until 1782.

The descendants of the  'Abid continued to be a powerful military contingent under the reign of Moulay Slimane (r. 1792–1822), but they were no longer the sultan's only pillar of military strength. Slimane took measures to curtail their power, such as recruiting tribal levies (as had been common practice before Isma'il's reign) to act as a counterbalance. Some of the  'Abid continue to hold powerful positions in both central and local government. Meknes continued to be one of their main bases during this period. During the later years of his reign, as he faced mounting rebellions and crises, Slimane sought to revive Isma'il's military policies and to re-enlist the Haratin (free black people) into the army. However, political instability rendered this task difficult and the number of Haratin that were enlisted does not appear to have been significant. Slimane's successor, Abd ar-Rahman, also attempted to re-enlist black soldiers in order to strengthen the military in response to the French conquest of Algeria that began in 1830. The trafficking of slaves also remained vigorous during throughout the early 19th century, and Abd ar-Rahman rebuffed British diplomatic requests to end the slave trade. However, after the defeat at the Battle of Isly (1844) and as contacts with Europe increased over the rest of the century, later 'Alawi sultans attempted to reform the military into a "modern" standing army with salaried soldiers instead of the traditional tribal levies. In the process, the number of black 'Abid soldiers also decreased. Under the reign of Moulay Hassan (r. 1873–1894) only about 5000 of them were still serving in the sultan's standing army, generally as cavalrymen. A French scholar who visited Morocco in the 1880s claimed that this number would increase during times of war. Over time, most of the former  'Abid and their descendants had left the army and gained their freedom. They scattered and resettled across the country. As former slaves, their free status was sometimes questioned, but Moroccan religious scholars generally affirmed that they were free. Some black individuals and families continued to hold powerful positions in the Moroccan government. The most notable example is Ahmad ibn Musa, also known Ba Ahmed, whose family monopolized the office of the sultan's hajib (a chamberlain and vizier) under multiple sultans in the 19th century. Ba Ahmed himself acted as de facto ruler of Morocco during the first four years of the reign of 'Abd al-Aziz (r. 1894–1908), whom he helped install on the throne. The trans-Saharan slave trade continued throughout the 19th century, even in the face of European abolitionist pressure, but by 1900 it had been significantly reduced. Slavery was officially abolished in Morocco in 1912, after the imposition of French colonial rule. Some descendants of the  'Abid continued to serve in the government afterwards in various positions.