# Egypt in the Middle Ages

Part of a series on the :
History of Egypt :
Prehistoric Egypt Paleolithic300,000–17,000 BC Mesolithic17,000–9000 BC Predynastic Period6000–3000 BC :
Ancient Egypt Early Dynastic Period3150–2686 BC Old Kingdom2686–2181 BC 1st Intermediate Period2181–2055 BC Middle Kingdom2055–1650 BC 2nd Intermediate Period1650–1550 BC New Kingdom1550–1069 BC 3rd Intermediate Period1069–664 BC Late Period664–332 BC :
Greco-Roman Egypt Argead dynasty332–310 BC Ptolemaic dynasties310–30 BC Roman and Byzantine Egypt30 BC–641 AD Sasanian Egypt619–629 :
Medieval Egypt Rashidun caliphate641–661 Umayyad caliphate661–750 Abbasid dynasty750–935 Tulunid dynasty868–905 Ikhshidid dynasty935–969 Fatimid dynasty969–1171 Ayyubid dynasty1171–1250 Mamluk dynasty1250–1517 :
Early modern Egypt Ottoman Egypt1517–1867 French occupation1798–1801 Muhammad Ali dynasty1805–1953 Khedivate of Egypt1867–1914 :
Late Modern Egypt British occupation1882–1922 Sultanate of Egypt1914–1922 Kingdom of Egypt1922–1953 Republic1953–present :
Egypt portal :
vte :
Historical Arab states and dynasties :
Ancient Arab states Kingdom of Qedar 800 BC–300 BC Kingdom of Lihyan 600 BC–100 BC Nabataean Kingdom 400 BC–106 AD Kingdom of Osroene 132 BC–244 AD Emesene Dynasty 64 BC–300s AD Kingdom of Hatra 100s–241 AD Tanukhids 196–1100 AD Ghassanids 220–638 AD Salihids 300s–500s AD Lakhmids 300s–602 AD Kingdom of Kinda 450 AD–550 AD :
Arab empires and caliphates Rashidun 632–661 Umayyads 661–750 Abbasids 750–1258 Fatimids 909–1171 :
Eastern dynasties Emirate of Armenia 654–884 Emirate of Tbilisi 736–1122 Emirate of Crete 824–961 Dulafids 840–897 Habbarids 854–1011 Kaysites 860–964 Shirvanshah 861–1538 Alavids 864–928 Hashimids 869–1075 Hamdanids 890–1004 Rawadids 955–1071 Mazyadids 961–1150 Jarrahids 970–1107 Uqaylids 990–1096 Numayrids 990–1081 Mirdasids 1024–1080 Munqidhites 1025–1157 Ma'nids 1517–1697 Turabays 1480–1677 Harfushs 1517–1865 Shihabs 1697–1842 :
Western dynasties and caliphates Salihids710–1019 Fihrid Emirate745-757 Umayyad state of Córdoba756–1031 Muhallabids771–793 Idrisids788–974 Aghlabids800–909 Sulaymanids814–922 Muslim Sicily831–1091 Kanzids1004–1412 Bakrids1012–1051 Tujibids1013–1039 Amirids1020–1086 Abbadids1023–1091 Yahsubids1023–1062 Hammudids1026–1057 Muzaynids1027–1063 Jawharids1031–1091 Hudids1039–1110 Sumadihids1041–1091 Tahirids1049–1078 Nasrids1230–1492 Saadids1554–1659 Senussids1837–1969 :
Arabian Peninsula Imamate of Oman 751–1970 Ziyadids 819–1138 Yufirids 847–997 Ukhaidhirds 865–1066 Rassids 897–1962 Qarmatians 899–1077 Wajihids 926–965 Sharifate of Mecca 968–1925 Sulayhids 1047–1138 Sulaymanids 1063–1174 Uyunids 1076–1253 Zurayids 1083–1174 Nabhanids 1154–1624 Mahdids 1159–1174 Rasulids 1229–1454 Usfurids 1253–1320 Jarwanids 1305–1487 Kathirids 1395–1967 Tahirids 1454–1526 Jabrids 1463–1521 Qasimids 1597–1872 Emirate of Khaza'il 1604–1921 Ya'arubids 1624–1742 Upper Yafa 1800–1967 Muscat and Oman 1820–1970 Rashidids 1836–1921 Qu'aitids 1858–1967 Emirate of Beihan 1903–1967 Idrisids 1906–1934 Mutawakkilite Kingdom 1926–1970 :
East Africa Makhzumi dynasty (Shewa) 896–1279 Nabahani dynasty (Pate Island) 1203–1894 Mahdali dynasty (Kilwa) 1277–1495 Mazrui dynasty (Mombasa) 1746–1828 Sultanate of Zanzibar 1856–1964 Nabahani dynasty (Wituland) 1858–1895 Tippu Tip's State 1860–1887 :
Current monarchies 'Alawis (Morocco) 1631–present Al Qasimi (Ras al Khaymah) 1727–present Al Qasimi (Sharjah) 1727–present Al Saud (Saudi Arabia) 1744–present Al Said (Oman) 1749–present Al Sabah (Kuwait) 1752–present Al Nahyan (Abu Dhabi) 1761–present Al Mualla (Umm al-Quwain) 1775–present Al Khalifa (Bahrain) 1783–present Al Nuaimi (Ajman) 1810–present Al Maktoum (Dubai) 1833–present Al Thani (Qatar) 1868–present Al Sharqi (Fujairah) 1900–present Hashemites (Jordan) 1921–present :
vte :
Following the Islamic conquest in 641-642, Lower Egypt was ruled at first by governors acting in the name of the Rashidun Caliphs and then the Umayyad Caliphs in Damascus, but in 750 the Umayyads were overthrown. Throughout Islamic rule, Askar was named the capital and housed the ruling administration. The conquest led to two separate provinces all under one ruler: Upper and Lower Egypt. These two very distinct regions were governed by the military and followed the demands handed down by the governor of Egypt and imposed by the heads of their communities.
Egypt was ruled by many dynasties from the start of Islamic control in 639 until the early 16th century. The Umayyad period lasted from 658 to 750. The Abbasid period which came after was much more focused on taxes and centralizing power. In 868, the Tulunids, ruled by Ahmad ibn Tulun, expanded Egypt's territory into the Levant. He would rule until his death in 884. After years of turmoil under Ahmad ibn Tulun's successor, many citizens defected back to the Abbasids and in 904 they would reclaim power from the Tulunids. In 969, Egypt came under the control of the Fatimids. This dynasty would begin to fade after the death of their last ruler in 1171.
In 1174, Egypt came under the rule of the Ayyubids, who ruled from Damascus and not from Cairo. This dynasty fought against the Crusader States during the Fifth Crusade. Ayyubid Sultan Najm al-Din recaptured Jerusalem in 1244. He introduced Mamluk forces into his army in order to hold off the crusaders. This decision would be one he regretted. The Ayyubids were overthrown by their bodyguards, known as the Mamluks in 1252 and ruled until 1517, when Egypt became part of the Ottoman Empire under the Eyālet-i Mıṣr province.

## Early Islamic period
### Muslim conquest of Egypt

In 639 an army of some 4,000 men were sent against Egypt by the second caliph, Umar, under the command of Amr ibn al-As. This army was joined by another 5,000 men in 640 and defeated a Byzantine army at the battle of Heliopolis. Amr next proceeded in the direction of Alexandria, which was surrendered to him by a treaty signed on November 8, 641. Alexandria was regained for the Byzantine Empire in 645 but was retaken by Amr in 646. In 654 an invasion fleet sent by Constans II was repulsed. From that time no serious effort was made by the Byzantines to regain possession of the country.

### Administration of early Islamic Egypt

Following the first surrender of Alexandria, Amr chose a new site to settle his men, near the location of the Byzantine fortress of Babylon. The new settlement received the name of Fustat, after Amr's tent, which had been pitched there when the Arabs besieged the fortress. Fustat quickly became the focal point of Islamic Egypt, and, with the exception of the brief relocation to Helwan during a plague in 689, and the period of 750–763, when the seat of the governor moved to Askar, the capital and residence of the administration. After the conquest, the country was initially divided in two provinces, Upper Egypt (al-sa'id) and Lower Egypt with the Nile Delta (asfal al-ard). In 643/4, however, Caliph Uthman appointed a single governor (wāli) with jurisdiction over all of Egypt, resident at Fustat. The governor would in turn nominate deputies for Upper and Lower Egypt. Alexandria remained a distinct district, reflecting both its role as the country's shield against Byzantine attacks, and as the major naval base. It was considered a frontier fortress (ribat) under a military governor and was heavily garrisoned, with a quarter of the province's garrison serving there in semi-annual rotation. Next to the wāli, there was also the commander of the police (ṣāḥib al-shurṭa), responsible for internal security and for commanding the jund (army).
The main pillar of the early Muslim rule and control in the country was the military force, or jund, staffed by the Arab settlers. These were initially the men who had followed Amr and participated in the conquest. The followers of Amr were mostly drawn from Yamani (south Arabian) tribes, rather than the northern Arab (Qays i) tribes, who were scarcely represented in the province; it was they who dominated the country's affairs for the first two centuries of Muslim rule. Initially, they numbered 15,500, but their numbers grew through emigration in the subsequent decades. By the time of Caliph Mu'awiya I (r. 661–680), the number of men registered in the army list (diwān al-jund) and entitled an annual pay (ʿaṭāʾ) reached 40,000. Jealous of their privileges and status, which entitled them to a share of the local revenue, the members of the jund then virtually closed off the register to new entries. It was only after the losses of the Second Fitna that the registers were updated, and occasionally, governors would add soldiers en masse to the lists as a means to garner political support.
In return for a very small tribute of money (0.5% Jizya Tax on some free men) and food for the troops, the Christian inhabitants of Egypt were excused from military service and left free in the observance of their religion and the administration of their affairs.
Conversions of Copts to Islam were initially rare, and the old system of taxation was maintained for the greater part of the first Islamic century. The old division of the country into districts (nomoi) was maintained, and to the inhabitants of these districts demands were directly addressed by the governor of Egypt, while the head of the community—ordinarily a Copt but in some cases a Muslim Egyptian—was responsible for compliance with the demand.

### Umayyad period

During the First Fitna, Caliph Ali (r. 656–661) appointed Muhammad ibn Abi Bakr as governor of Egypt, but Amr led an invasion in summer 658 that defeated Ibn Abi Bakr and secured the country for the Umayyads. Amr then served as governor until his death in 664. From 667/8 until 682, the province was governed by another fervent pro-Umayyad partisan, Maslama ibn Mukhallad al-Ansari. During the Second Fitna, Ibn al-Zubayr gained the support of the Kharijites in Egypt and sent a governor of his own, Abd al-Rahman ibn Utba al-Fihri, to the province. The Kharijite-backed Zubayrid regime was very unpopular with the local Arabs, who called upon the Umayyad caliph Marwan I (r. 684–685) for aid. In December 684, Marwan invaded Egypt and reconquered it with relative ease. Marwan installed his son Abd al-Aziz as governor. Relying on his close ties with the jund, Abd al-Aziz ruled the country for 20 years, enjoying wide autonomy and governing as a de facto viceroy. Abd al-Aziz also supervised the completion of the Muslim conquest of North Africa; it was he who appointed Musa ibn Nusayr in his post as governor of Ifriqiya. Abd al-Aziz hoped to be succeeded by his son, but when he died, Caliph Abd al-Malik ibn Marwan (685–695) sent his own son, Abdallah, as governor in a move to reassert control and prevent the country from becoming a hereditary domain.
Abd al-Malik ibn Rifa'a al-Fahmi in 715 and his successor Ayyub ibn Sharhabil in 717 were the first governors chosen from the jund, rather than members of the Umayyad family or court. Both are reported to have increased pressure on the Copts, and initiated measures of Islamization. The resentment of the Copts against taxation led to a revolt in 725. In 727, to strengthen Arab representation, a colony of 3,000 Arabs was set up near Bilbeis. Meanwhile, the employment of the Arabic language had been steadily gaining ground, and in 706 it was made the official language of the government. Egyptian Arabic, the modern Arabic accent and dialect of Egypt, began to form. Other revolts of the Copts are recorded for the years 739 and 750, the last year of Umayyad domination. The outbreaks in all cases are attributed to increased taxation.

### Abbasid period

The Abbasid period was marked by new taxations, and the Copts revolted again in the fourth year of Abbasid rule. At the beginning of the 9th century the practice of ruling Egypt through a governor was resumed under Abdallah ibn Tahir, who decided to reside at Baghdad, sending a deputy to Egypt to govern for him. In 828 another Egyptian revolt broke out, and in 831 the Copts joined with native Muslims against the government.
A major change came in 834, when Caliph al-Mu'tasim discontinued the practice of paying the jund as they nominally still formed the province's garrison—the ʿaṭāʾ from the local revenue. Al-Mu'tasim discontinued the practice, removing the Arab families from the army registers diwān and ordering that the revenues of Egypt be sent to the central government, which would then pay the ʿaṭāʾ only to the Turkish troops stationed in the province. This was a move towards centralizing power in the hands of the central caliphal administration, but also signalled the decline of the old elites, and the passing of power to the officials sent to the province by the Abbasid court, most notably the Turkish soldiers favoured by al-Mu'tasim. At about the same time, for the first time the Muslim population began surpassing the Coptic Christians in numbers, and throughout the 9th century the rural districts were increasingly subject to both Arabization and Islamization. The rapidity of this process, and the influx of settlers after the discovery of gold and emerald mines at Aswan, meant that Upper Egypt in particular was only superficially controlled by the local governor. Furthermore, the persistence of internecine strife and turmoil at the heart of the Abbasid state—the so-called "Anarchy at Samarra"—led to the appearance of millennialist revolutionary movements in the province under a series of Alid pretenders in the 870s. In part, these movements were an expression of dissatisfaction with and alienation from imperial rule by Baghdad; these sentiments would manifest themselves in the support of many Egyptians for the Fatimids in the 10th century.

### Tulunid period

In 868, Caliph al-Mu'tazz (r. 866–869) gave charge of Egypt to the Turkish general Bakbak. Bakbak in turn sent his stepson Ahmad ibn Tulun as his lieutenant and resident governor. This appointment ushered in a new era in Egypt's history: hitherto a passive province of an empire, under Ibn Tulun it would re-emerge as an independent political centre. Ibn Tulun would use the country's wealth to extend his rule into the Levant, in a pattern followed by later Egypt-based regimes, from the Ikhshidids to the Mamluk Sultanate.
The first years of Ibn Tulun's governorship were dominated by his power struggle with the powerful head of the fiscal administration, the Ibn al-Mudabbir. The latter had been appointed as fiscal agent (ʿāmil) already since c. 861, and had rapidly become the most hated man in the country as he doubled the taxes and imposed new ones on Muslims and non-Muslims alike. By 872 Ibn Tulun had achieved Ibn al-Mudabirbir's dismissal and taken over the management of the fisc himself, and had managed to assemble an army of his own, thereby becoming de facto independent of Baghdad. As a sign of his power, he established a new palace city to the northeast of Fustat, called al-Qata'i, in 870. The project was a conscious emulation of, and rival to, the Abbasid capital Samarra, with quarters assigned to the regiments of his army, a hippodrome, hospital, and palaces. The new city's centrepiece was the Mosque of Ibn Tulun. Ibn Tulun continued to emulate the familiar Samarra model in the establishment of his administration as well, creating new departments and entrusting them to Samarra-trained officials. His regime was in many ways typical of the "ghulām system" that became one of the two main paradigms of Islamic polities in the 9th and 10th centuries, as the Abbasid Caliphate fragmented and new dynasties emerged. These regimes were based on the power of a regular army composed of slave soldiers or ghilmān, but in turn, according to Hugh N. Kennedy, "the paying of the troops was the major preoccupation of government". It is therefore in the context of the increased financial requirements that in 879, the supervision of the finances passed to Abu Bakr Ahmad ibn Ibrahim al-Madhara'i, the founder of the al-Madhara'i bureaucratic dynasty that dominated the fiscal apparatus of Egypt for the next 70 years. The peace and security provided by the Tulunid regime, the establishment of an efficient administration, and repairs and expansions to the irrigation system, coupled with a consistently high level of Nile floods, resulted in a major increase in revenue. By the end of his reign, Ibn Tulun had accumulated a reserve of ten million dinars.
Ibn Tulun's rise was facilitated by the feebleness of the Abbasid government, threatened by the rise of the Saffarids in the east and by the Zanj Rebellion in Iraq itself, and divided due to the rivalry between Caliph al-Mu'tamid (r. 870–892) and his increasingly powerful brother and de facto regent, al-Muwaffaq. Open conflict between Ibn Tulun and al-Muwaffaq broke out in 875/6. The latter tried to oust Ibn Tulun from Egypt, but the expedition sent against him barely reached Syria. In retaliation, with the support of the Caliph, in 877/8 Ibn Tulun received responsibility for the entirety of Syria and the frontier districts of Cilicia (the Thughūr). Ibn Tulun occupied Syria but failed to seize Tarsus in Cilicia, and was forced to return to Egypt due to the abortive revolt of his eldest son, Abbas. Ibn Tulun has Abbas imprisoned, and named his second son, Khumarawayh, as his heir. In 882, Ibn Tulun came close to having Egypt become the new centre of the Caliphate, when al-Mu'tamid tried to flee to his domains. In the event, however, the Caliph was overtaken and brought him back to Samarra (February 883) and under his brother's control. This opened anew the rift between the two rulers: Ibn Tulun organized an assembly of religious jurists at Damascus which denounced al-Muwaffaq a usurper, condemned his maltreatment of the Caliph, declared his place in the succession as void, and called for a jihād against him. Al-Muwaffaq was duly denounced in sermons in the mosques across the Tulunid domains, while the Abbasid regent responded in kind with a ritual denunciation of Ibn Tulun. Ibn Tulun then tried once more, again without success, to impose his rule over Tarsus. He fell ill on his return journey to Egypt, and died at Fustat on 10 May 884.
At Ibn Tulun's death, Khumarawayh, with the backing of the Tulunid elites, succeeded without opposition. Ibn Tulun bequeathed his heir "with a seasoned military, a stable economy, and a coterie of experienced commanders and bureaucrats". Khumarawayh was able to preserve his authority against the Abbasid's attempt to overthrow him at the Battle of Tawahin and even made additional territorial gains, recognized in a treaty with al-Muwaffaq in 886 that gave the Tulunids the hereditary governorship over Egypt and Syria for 30 years. The accession of al-Muwaffaq's son al-Mu'tadid as Caliph in 892 marked a new rapprochement, culminating in the marriage of Khumarawayh's daughter to the new Caliph, but also the return of the provinces of Diyar Rabi'a and Diyar Mudar to caliphal control. Domestically, Khumarawayh's reign was one of "luxury and decay" (Hugh N. Kennedy), but also a time of relative tranquility in Egypt as well as in Syria, a rather unusual occurrence for the period. Nevertheless, Khumarawayh's extravagant spending exhausted the fisc, and by the time of his assassination in 896, the Tulunid treasury was empty. Following Khumarawayh's death, internal strife sapped Tulunid power. Khumarawayh's son Jaysh was a drunkard who executed his uncle, Mudar ibn Ahmad ibn Tulun; he was deposed after only a few months and replaced by his brother Harun ibn Khumarawayh. Harun too was a weak ruler, and although a revolt by his uncle Rabi'ah in Alexandria was suppressed, the Tulunids were unable to confront the attacks of the Qarmatians who began at the same time. In addition, many commanders defected to the Abbasids, whose power revived under the capable leadership of al-Muwaffaq's son, Caliph al-Mu'tadid (r. 892–902). Finally, in December 904, two other sons of Ibn Tulun, Ali and Shayban, murdered their nephew and assumed control of the Tulunid state. Far from halting the decline, this event alienated key commanders in Syria and led to the rapid and relatively unopposed reconquest of Syria and Egypt by the Abbasids under Muhammad ibn Sulayman al-Katib, who entered Fustat in January 905. With the exception of the Great Mosque of Ibn Tulun, the victorious Abbasid troops pillaged al-Qata'i and razed it to the ground.

### Second Abbasid period and Ikhshidid period

The Abbasids were able to repulse Fatimid invasions of Egypt in 914–915 and 919–921.
In 935, after repulsing another Fatimid attack, the Turkish commander Muhammad ibn Tughj became the de facto ruler of Egypt with the title of al-Ikhshid. After his death in 946, the succession of his son Unujur was peaceful and undisputed, due to the influence of the powerful and talented commander-in-chief, Kafur. One of the many Black African slaves recruited by al-Ikhshid, Kafur remained the paramount minister and virtual ruler of Egypt over the next 22 years, assuming power in his own right in 966 until his death two years later. Encouraged by his death, in 969 the Fatimids invaded and conquered Egypt, beginning a new era in the country's history.

## Fatimid period

Jawhar as-Siqilli immediately began the building of a new city, Cairo, to furnish quarters for the army which he had brought. A palace for the Caliph and a mosque for the army were immediately constructed, which for many centuries remained the centre of Muslim learning. However, the Carmathians of Damascus under Hasan al-Asam advanced through Palestine to Egypt, and in the autumn of 971 Jauhar found himself besieged in his new city. By a timely sortie, preceded by the administration of bribes to various officers in the Carmathian host, Jauhar succeeded in inflicting a severe defeat on the besiegers, who were compelled to evacuate Egypt and part of Syria.
Meanwhile, the caliph in 2 al-Muizz had been summoned to enter the palace that had been prepared for him, and after leaving a viceroy to take charge of his western possessions he arrived in Alexandria on May 31 973, and proceeded to instruct his new subjects in the particular form of religion (Shiism) which his family represented. As this was in origin identical with that professed by the Carmathians, he hoped to gain the submission of their leader by argument; but this plan was unsuccessful, and there was a fresh invasion from that quarter in the year after his arrival, and the caliph found himself besieged in his capital.
The Carmathians were gradually forced to retreat from Egypt and then from Syria by some successful engagements, and by the judicious use of bribes, whereby dissension was sown among their leaders. Al-Muizz also found time to take some active measures against the Byzantines, with whom his generals fought in Syria with varying fortune. Before his death he was acknowledged as Caliph in Mecca and Medina, as well as Syria, Egypt and North Africa as far as Tangier.
Under the vizier al-Aziz, there was a large amount of toleration conceded to the other sects of Islam, and to other communities, but the belief that the Christians of Egypt were in league with the Byzantine emperor, and even burned a fleet which was being built for the Byzantine war, led to some persecution. Al-Aziz attempted without success to enter into friendly relations with the Buwayhid ruler of Baghdad, and tried to gain possession of Aleppo, as the key to Iraq, but this was prevented by the intervention of the Byzantines. His North African possessions were maintained and extended, but the recognition of the Fatimid caliph in this region was little more than nominal.
His successor al-Hakim bi-Amr Allah came to the throne at the age of eleven, being the son of Aziz by a Christian mother. His conduct of affairs was vigorous and successful, and he concluded a peace with the Byzantine emperor. He is perhaps best remembered by his destruction of the Church of the Holy Sepulchre in Jerusalem (1009), a measure which helped to provoke the Crusades, but was only part of a general scheme for converting all Christians and Jews in his dominions to his own opinions by force.
A more reputable expedient with the same end in view was the construction of a great library in Cairo, with ample provision for students; this was modelled on a similar institution at Baghdad. For unknown reasons al-Hakim disappeared in 1021.
In 1049 the Zirid dynasty in the Maghrib returned to the Sunni faith and became subjects of the Caliphate in Baghdad, but at the same time Yemen recognized the Fatimid caliphate. Meanwhile, Baghdad was taken by the Turks, falling to the Seljuk Tughrul Beg in 1059. The Turks also plundered Cairo in 1068, but they were driven out by 1074. During this time, however, Syria was overrun by an invader in league with the Seljuk Malik Shah, and Damascus was permanently lost to the Fatimids. This period is otherwise memorable for the rise of the Hashshashin, or Assassins.
During the Crusades, al-Mustafa maintained himself in Alexandria, and helped the Crusaders by rescuing Jerusalem from the Ortokids, thereby facilitating its conquest by the Crusaders in 1099. He endeavoured to retrieve his error by himself advancing into Palestine, but he was defeated at the battle of Ascalon, and compelled to retire to Egypt. Many of the Palestinian possessions of the Fatimids then successively fell into the hands of the Crusaders.
In 1118 Egypt was invaded by Baldwin I of Jerusalem, who burned the gates and the mosques of Farama, and advanced to Tinnis, when illness compelled him to retreat. In August 1121 al-Afdal Shahanshah was assassinated in a street of Cairo, it is said, with the connivance of the Caliph, who immediately began the plunder of his house, where fabulous treasures were said to be amassed. The vizier's offices were given to al-Mamn. His external policy was not more fortunate than that of his predecessor, as he lost Tyre to the Crusaders, and a fleet equipped by him was defeated by the Venetians.
In 1153 Ascalon was lost, the last place in Syria which the Fatimids held; its loss was attributed to dissensions between the parties of which the garrison consisted. In April 1154 the Caliph al-Zafir was murdered by his vizier Abbas, according to Usamah, because the Caliph had suggested to his favorite, the vizier's son, to murder his father; and this was followed by a massacre of the brothers of Zafir, followed by the raising of his infant son Abul-Qasim Isa to the throne.
In December 1162, the vizier Shawar took control of Cairo. However, after only nine months he was compelled to flee to Damascus, where he was favorably received by the prince Nureddin, who sent with him to Cairo a force of Kurds under Asad al-din Shirkuh. At the same time Egypt was invaded by the Franks, who raided and did much damage on the coast. Shawar recaptured Cairo but a dispute then arose with his Syrian allies for the possession of Egypt. Shawar, being unable to cope with the Syrians, demanded help of the Frankish king of Jerusalem Amalric I, who hastened to his aid with a large force, which united with Shawar's and besieged Shirkuh in Bilbeis for three months; at the end of this time, owing to the successes of Nureddin in Syria, the Franks granted Shirkuh a free passage with his troops back to Syria, on condition of Egypt being evacuated (October 1164).
Two years later Shirkuh, a Kurdish general known as "the Lion", persuaded Nureddin to put him at the head of another expedition to Egypt, which left Syria in January 1167; a Frankish army hastened to Shawar's aid. At the battle of Babain (April 11, 1167) the allies were defeated by the forces commanded by Shirkuh and his nephew Saladin, who was made prefect of Alexandria, which surrendered to Shirkuh without a struggle. In 1168 Amalric invaded again, but Shirkuh's return caused the Crusaders to withdraw.
Shirkuh was appointed vizier but died of indigestion (March 23, 1169), and the Caliph appointed Saladin as successor to Shirkuh; the new vizier professed to hold office as a deputy of Nureddin, whose name was mentioned in public worship after that of the Caliph. Nureddin loyally aided his deputy in dealing with Crusader invasions of Egypt, and he ordered Saladin to substitute the name of the Abbasid caliph for the Fatimid in public worship. The last Fatimid caliph died soon after in September, 1171.

## Ayyubid period

Saladin, a general known as "the Lion", was confirmed as Nureddin's deputy in Egypt, and on the death of Nureddin on April 12, 1174, he took the title sultan. During his reign Damascus, rather than Cairo, was the major city of the empire. Nevertheless, he fortified Cairo, which became the political centre of Egypt. It was in 1183 that Saladin's rule over Egypt and North Syria was consolidated. Much of Saladin's time was spent in Syria, where he fought the Crusader States, and Egypt was largely governed by his deputy Karaksh.
Saladin's son Othman succeeded him in Egypt in 1193. He allied with his uncle (Saladin's brother) Al-Adil I against Saladin's other sons, and after the wars that followed, Al-Adil took power in 1200. He died in 1218 during the siege of Damietta in the Fifth Crusade, and was succeeded by Al-Kamil, who lost Damietta to the Crusaders in 1219. However, he defeated their advance to Cairo by flooding the Nile, and they were forced to evacuate Egypt in 1221. Al-Kamil was later forced to give up various cities in Palestina and Syria to Frederick II, Holy Roman Emperor during the Sixth Crusade, in order to gain his help against Damascus.
Najm al-Din became sultan in 1240. His reign saw the recapture of Jerusalem in 1244, and the introduction of a larger force of Mameluks into the army. Much of his time was spent in campaigns in Syria, where he allied with the Khwarezmians against the Crusaders and Ayyubids. In 1249 he faced an invasion by Louis IX of France (the Seventh Crusade), and Damietta was lost again. Najm al-Din died soon after this, but his son Turanshah defeated Louis and expelled the Crusaders from Egypt. Turanshah was soon overthrown by the Mameluks, who had become the "kingmakers" since their arrival and now wanted full power for themselves.

## Mamluk Egypt

The Mamluk's violent approach to power brought them great political and economic prosperity and led them to becoming the rulers of Egypt. The Mamluk Egypt period began with the Bahri Dynasty and was followed by the Burji Dynasty. The Bahri Dynasty would rule from 1250 to 1382, while the Burji dynasty would last from 1382 to 1517.
Cultural contributions of the Mamluk Empire spanned across more than religion. Literature and astronomy were two subjects which the Mamluks valued and participated in heavily. They were a highly literate and educated society. Private libraries were a status symbol in Mamluk culture. Some of the libraries discovered show evidence of the remnants of thousands of books.
The end of the period was brought about due to famine, military tensions, disease, and high taxation.

### Bahri dynasty

The Mamluk sultans were drawn from the freed slaves who formed the court and went on to become slaveowners themselves, they went on to office the army. The sultans were unable to effectively form a new dynasty, usually leaving behind infants who were then overthrown. The Bahri dynasty (1250–1382) would go through 25 sultans in its 132-year period. Many died or were killed shortly after being in power; very few lived more than a few years into their rule as sultan. The first of these was Aybak, who married Shajar al-Durr (the widow of al-Salih Ayyub) and quickly began a war with the region of present-day Syria. He was assassinated in 1257 and was succeeded by Qutuz, who faced a growing danger from the Mongols.
Qutuz defeated the army of Hulagu Khan at the Battle of Ain Jalut in the year 1260, allowing him to regain all of Syria except for the Crusader strongholds. On the way back to Egypt after the battle, Qutuz died and was succeeded by another commander, Baybars, who assumed the sultanate and ruled from 1260 to 1277. In 1291, al-Ashraf Khalil captured Acre, the last of the crusader cities. The Bahris greatly enhanced the power and prestige of Egypt, building Cairo from a small town into one of the foremost cities in the world.
Due to the sacking of Baghdad by the Mongols in 1258, Cairo became the central city of the Islamic world. The Mamluks built much of the earliest remaining architecture of Cairo, including many mosques built out of stone using long, imposing lines.
Since 1347 the Egyptian population, economy, and political system experienced significant destruction as a result of the Black Death pandemic whose waves continued to destroy Egypt up to the early 16th century.
In 1377 a revolt in Syria spread to Egypt, and the government was taken over by the Circassians Berekeh and Barkuk. Barkuk was proclaimed sultan in 1382, ending the Bahri dynasty. He was expelled in 1389, but recaptured Cairo in 1390, setting up the Burji dynasty.

### Burji dynasty

The Burji dynasty (1382–1517) proved especially turbulent, with political power-plays resulting in short-lived sultans. During the period, the Mamluks fought Timur Lenk and conquered Cyprus.
Plague epidemics continued to ruin Egypt when it spread over the region in 1388–1389, 1397–1398, 1403–1407, 1410–1411, 1415–1419, 1429–1430, 1438–1439, 1444–1449, 1455, 1459–1460, 1468–1469, 1476–1477, 1492, 1498, 1504–1505 and 1513–1514.
Constant political bickering contributed to the inability to resist the Ottomans, this would see the vassalization of Egypt under Ottoman Sultan Selim I. The sultan defeated the Mamluks and captured Cairo on 20 January 1517, transferring the center of power to Istanbul. However, the Ottoman Empire retained the Mamluks as the Egyptian ruling class. The Mamluks and the Burji family regained much of their influence, but technically remained vassals of the Ottomans. Egypt then entered into the middle period of the Ottoman Empire.