Shortly after Salah al-Din ibn Ayyub took control of Cairo in 1171, he chose a new site for the seat of government, building a fortress known as the Citadel on a promontory beneath the Muqattam hills which gave him a commanding view of the city. In an area just below the Citadel he laid out a parade ground where his troops gathered for military exercises and sporting activities, including games of polo. For the next 700 years, Egypt was ruled from the Citadel.
The Ayyubid dynasty founded by Salah al-Din came increasingly to rely on the services of a caste of elite slave soldiers called mamluks recruited from the Eurasian steppes and the Caucasus to provide military backbone. Mamluks had bolstered the armies of several Islamic rulers since the ninth century. Sold by their families and separated from their homeland, they owed total obedience to their patrons. Because of their loyalty, mamluk amirs or commanders often rose to high positions in government. Their role in Egypt became even more important as a result of threats that Ayyubid rulers faced both from Crusader armies and from approaching Mongol hordes. When French invaders landed in Egypt in 1249, a mamluk regiment played a decisive role in their defeat. The following year, mamluk amirs seized power and established their own sultanate.
The Mamluk sultanate became a self-perpetuating military oligarchy that lasted for more than 260 years. To fortify their numbers, mamluk amirs used Muslim merchants to purchase youths from Turkic tribes north of the Caspian Sea who were brought to Cairo, given rigorous training in Islam and in military skills, notably horsemanship and archery, then freed to become professional soldiers in cavalry regiments. Military schools instilled into the youths a strict code of obedience and discipline and a clear sense of hierarchy. The more fortunate recruits were allocated to the sultan’s household and were expected to rise to high positions in the Mamluk hierarchy.
To keep discipline at a peak, the Mamluk system prohibited the sons of soldiers from following their fathers into the profession. Writing about the advantages of the system, the Islamic scholar Ibn Khaldun, who spent much time in Egypt, observed: ‘The rulers choose from among these Mamluks, who are imported to them, horsemen and soldiers. These Mamluks are more courageous in war and endure privation better than the sons of Mamluks who had preceded them and who were reared in easy circumstances and in the shadow of rulership.’ The process of recruitment thus continued year after year. Most youths came from the impoverished Kipchak and Cuman areas of Eurasia; later they were drawn from the Circassian region of the Caucasus. Twelve military schools, capable of holding 1,000 trainees, were kept open to accommodate them.
The founder of Mamluk power, Al-Malik al-Zahir Baybars, was a former slave from Kipchak who became a renowned military leader and then sultan in 1260. Facing the threat of invasion by Crusaders and Mongols alike, Baybars established a unified military structure, rebuilt the navy, ensured his army was provided with suitable equipment and rewarded senior officers with large land grants. He also paid attention to public works, commissioned canals, harbour renovations and mosque improvements and devised a swift postal service that used both horse relays and pigeons.
The early decades of Mamluk rule brought Egypt considerable prosperity. Among the architectural legacies is the Sultan Hassan mosque, completed in 1363, which was deemed at the time to be the greatest mosque in the entire Muslim world. Ibn Khaldun, who lived in Cairo for twenty-four years, serving there as a grand judge, described the city in the late fourteenth century as ‘the metropolis of the universe, garden of the world’.
But much of the vigour of the Mamluk system was eventually dissipated in factional disputes, land-grabbing and a loss of discipline. In the mid-fourteenth century, Egypt suffered grievously from the Black Death, the pneumonic plague that tore through the Afro-Eurasian land mass. In eighteen months, the plague killed perhaps a quarter of Egypt’s population. An Egyptian chronicler, al-Magrizi, wrote: ‘Cairo became an empty desert, and there was no one to be seen in the streets. A man could go from the Zuwalya Gate to the Bab al-Nasr without encountering another soul. The dead were so numerous that people thought only of them.’ Ibn Khaldun, who lost his mother and father to the Black Death, believed that it threatened the very foundations of civilisation. ‘Cities and buildings were laid waste, roads and way signs were obliterated, settlements and mansions became empty, dynasties and tribes grew weak. The entire world changed.’ Egypt’s fate was worse than in many other countries. Unlike in Europe, the plague remained recurrent, breaking out twenty-eight times over the next 160 years. In a weakened state, Egypt was vulnerable to foreign predators once more.
In January 1517, an Ottoman army invaded Egypt from the Levant and advanced on the walled city of Cairo. Since the fourteenth century, the Ottomans had expanded from ruling a minor Turkish Muslim principality in the north-western corner of Anatolia into controlling a vast empire in western Asia and the Balkans. In 1453, the Ottoman sultan, Mehmed II, captured the old Byzantine city of Constantinople, renamed it Istanbul and proclaimed it to be his imperial capital. ‘The world empire must be one,’ he declared, ‘with one faith, and one sovereignty.’ Egypt was high on the list of Ottoman objectives.
Like the Mamluks, Ottoman rulers relied on slave armies and administrators whose loyalty to them was unquestioned. Slave recruitment took place primarily among conquered populations in the Balkans in an annual conscription known in Turkish as devshirme, or ‘boy levy’. Young Christian boys were sent to Istanbul, converted to Islam and trained to serve either as soldiers in elite janissary infantry regiments or as bureaucrats in the civil service. Some rose to the highest ranks of both the army and government.
The battle between Ottoman invaders and the Mamluk army on the northern outskirts of Cairo on January 23 was over within hours. The Ottomans were equipped as a modern army using muskets and gunpowder; the Mamluks were accustomed to hand-to-hand combat wielding swords. The victorious Ottoman troops stormed Cairo and pillaged the city for three days. In an ignominious finale to Mamluk rule, the last Mamluk sultan, Tumanbay, was marched through the centre of Cairo to the gate at Bab Zuwalya and hanged before a horrified crowd.
Egypt was thus reduced to the status of a colonial province of the Ottoman empire, subject to diktats from Istanbul. For the bulk of the population, it made little difference. Mamluk rule and Ottoman rule had much in common. The elites of both empires were Turkish-speaking foreigners. Both empires were bureaucratic states that observed Islamic law. The principal aim of the Ottomans in Egypt was much the same as that of the Mamluks: to enforce law and order and to ensure that the population paid as much tax as possible. In the case of the Ottomans, tax levies were raised not only to cover the costs of Ottoman military units stationed in Egypt but to pay for an annual tribute of gold and grain to Istanbul. Egypt was a lucrative property, and the Ottomans set out to obtain the maximum revenues from it. To this end, they enlisted the cooperation of Mamluk administrators and allowed Mamluks to form their own military unit and to continue recruiting young slaves to serve in their households as before. A form of partnership emerged, albeit one that was prone to occasional tensions.
The Ottomans were next drawn into an intense struggle underway between Muslim and Christian forces for control of the coastal lands of north-west Africa. At the turn of the sixteenth century, Spanish kings, having conquered the Muslim emirate of Granada and brought an end to nearly eight centuries of Muslim rule in Spain, pursued their holy war across the Mediterranean to the Muslim kingdoms of the Maghreb. Facing little opposition, they established a string of fortress colonies, or presidios, along the coast from Morocco to Tripolitania and forced local dynasties in Fez (in Morocco), Tlemcen (in Algeria) and Tunis to pay tribute to the Spanish crown.
The main resistance to Spain’s occupation came from local sailors who armed their ships and plundered Spanish vessels for cargoes and captives. In Europe, these corsairs were regarded as a barbarian menace, reviled for selling thousands of Christian sailors into slavery. But they themselves viewed their war as a religious conflict against Christian invaders and were seen by Arab and Berber inhabitants of the coast as local heroes.
The most famous of the corsair commanders were two brothers, ‘Aruj and Hizir, both known in Europe by the Italian name of Barbarossa. Born on the Ottoman island of Mytilene (now Lesbos), they began their seafaring careers as privateers in the eastern Mediterranean, but shifted their operations to the western Mediterranean where the opportunities for plunder from Spanish shipping were greater. In 1504, they obtained permission from the Beni Hafsid sultan in Tunis to use the nearby port of Halq al-Wadi (Guletta) as a base. Their raids on Sicily, Sardinia, the Balearic Islands and the Spanish mainland made them widely feared by coastal communities in southern Europe. In 1516, they succeeded in liberating El Djezair (Algiers) from Spanish rule. After consolidating control over the surrounding region and forcing the Beni Ziyad ruler to flee, ‘Aruj declared himself the new sultan of Algiers and set out to extend his power to Tlemcen in the west, but was killed there in 1517.
His place was taken by his younger brother Hizir who inherited the name Barbarossa. Needing the support of a powerful ally against the might of Spain, in 1519 Hizir sent an envoy to the Ottoman court, bearing gifts and a petition from the Algiers population asking for protection in the war against Christian invaders and offering to submit themselves to Ottoman rule. The envoy duly returned home with an Ottoman flag and a detachment of 2,000 janissaries. The arrival of Ottoman forces in the western Mediterranean shifted the balance of power there decisively.
The Ottomans established three more provinces in North Africa based on capitals in Algiers, Tunis and Tripoli. Initially, governors were sent out from Istanbul to maintain control, backed by janissaries. Turks held most of the offices of government and formed the regular army – the ojak. Their children, known as kouloughlis, constituted a separate elite, acting as a second army of spahis or cavalrymen. But though the Barbary states remained within the orbit of the Ottoman empire, they became in effect self-governing enterprises. Ottoman influence was gradually replaced by the growing power of locally based potentates. By the eighteenth century, both Tunis and Tripoli had become hereditary monarchies of kouloughli origin. In Algiers, the captains of the janissaries held sway.
Corsair fleets continued their raids with official approval, making huge fortunes from captured merchandise and from the sale or ransom of captives. Their field of operation widened considerably during the seventeenth century when they began to use square-rigged sailing ships instead of galleys. Their activities formed the backbone of the economy. Corsair loot paid for the wages of government officials, furnished their residences and financed the building of harbour defences, aqueducts and mosques. Christian slaves were used as a ready supply of labour. They worked on construction gangs and as galley slaves, agricultural labourers and quarrymen. Skilled artisans were consigned to shipyards and arsenals and made a significant contribution to maintaining the fighting capacity of corsair fleets. Women and girls were sent to the harems. The only escape for white captives was to organise payment of a ransom or to ‘turn Turk’ – convert to Islam.
The booming port-city of Algiers became the base for a fleet of seventy-five corsair ships and the principal entrepôt for European slaves. Between 1550 and 1730, the white slave population there stood consistently at about 25,000 and sometimes reached double that number. With so much slave labour on hand, Algiers blossomed into one of the most beautiful cities in the world. Contemporary writers remarked on the immaculate state of the streets, the elegant houses, manicured gardens and handsome pavilions. White slave labour helped build the Mole, a large breakwater protecting the harbour, dragging giant blocks of rock weighing twenty tons or more from hills outside the city. Tunis and Tripoli held about 7,500 Christian captives over the same period. The ports of Algiers, Tunis and Tripoli also served as a haven for thousands of European pirates, many of whom ‘turned Turk’ and who joined in the plunder of Christian shipping with equal enthusiasm, sharing the profits with ruling officials. ‘If I met my own father at sea I would rob him and sell him when I was done,’ boasted John Ward, an infamous seventeenth-century English pirate based in Tunis.
The white slave population needed continual replenishment. Some were ransomed; some converted; thousands died from disease and ill-treatment. New arrivals destined for the slave auctions of Algiers, Tunis and Tripoli numbered on average about 5,000 a year during the boom years of the trade. Modern historians estimate that in all, between 1530 and 1780, at least a million European captives were enslaved on the Barbary coast.