The Fatimid conquest of Egypt took place in 969 when the troops of the Fatimid Caliphate under the general Jawhar captured Egypt, then ruled by the autonomous Ikhshidid dynasty in the name of the Abbasid Caliphate.
The Fatimids launched repeated invasions of Egypt soon after coming to power in Ifriqiya (modern Tunisia and eastern Algeria) in 909, but failed against the still-strong Abbasid Caliphate. By the 960s, however, while the Fatimids had consolidated their rule and grown stronger, the Abbasid Caliphate had collapsed, and the Ikhshidid regime was facing prolonged crisis: foreign raids and a severe famine were compounded by the death in 968 of the strongman Abu al-Misk Kafur. The resulting power vacuum led to open infighting among the various factions in Fustat, the capital of Egypt. The atmosphere of crisis was deepened by the simultaneous advances of the Byzantine Empire against the Muslim states of the Eastern Mediterranean. Meanwhile, Fatimid agents operated openly in Egypt, and the local elites increasingly came to accept and even welcome the prospect of a Fatimid takeover in hopes of ending the instability and insecurity.
Faced with this favourable situation, the Fatimid caliph al-Mu'izz li-Din Allah organized a large expedition to conquer Egypt. Led by Jawhar, the expedition set off from Raqqada in Ifriqiya on 6 February 969, and entered the Nile Delta two months later. The Ikhshidid elites preferred to negotiate a peaceful surrender, and Jawhar issued a writ of safe-conduct (), promising to respect the rights of the Egyptian notables and populace and take up the against the Byzantines. The Fatimid army overcame the attempts of the Ikhshidid soldiery to prevent its crossing of the Nile river between 29 June and 3 July, while in the chaos pro-Fatimid agents took control of Fustat and declared its submission to al-Mu'izz. Jawhar renewed his and took possession of the city on 6 July, with the Friday prayer read in the name of al-Mu'izz on 9 July.
For the next four years Jawhar served as viceroy of Egypt, quelling rebellions and beginning the construction of a new capital, Cairo. His attempts to expand into the former Ikhshidid domains in Syria, and even attack the Byzantines, backfired: after swift initial progress, the Fatimid armies were destroyed, and Egypt itself faced a Qarmatian invasion that was fought off just north of Cairo. Al-Mu'izz arrived in Egypt in 973, and took up residence in Cairo, which became the seat of the Fatimid Caliphate for the remainder of its existence, until the abolition of the Fatimid regime by Saladin in 1171.
Background: initial Fatimid attempts to capture Egypt
The Fatimid dynasty came to power in Ifriqiya (modern Tunisia and northeastern Algeria) in 909. The Fatimids had fled their home in Syria a few years before, and made for the Maghreb, where their agents had made considerable headway in converting the Kutama Berbers to the Fatimid-sponsored Isma'ili branch of Shi'a Islam. While the Fatimids remained hidden, the Isma'ili missionary Abu Abdallah al-Shi'i led the Kutama to overthrow the reigning Aghlabid dynasty, allowing the Fatimid leader to reveal himself publicly and declare himself caliph with the regnal name of al-Mahdi Billah (). In contrast to their predecessors, who were content to remain a regional dynasty on the western fringes of the Abbasid Caliphate, the Fatimids held ecumenical pretensions: claiming descent from Fatima, the daughter of Muhammad and wife of Ali, the Fatimid caliphs were simultaneously the leaders of the Isma'ili sect, whose followers accorded them semi-divine status as imams, the lawful vicegerents of God on earth. Consequently, the Fatimids regarded their rise to power as the first step in the restoration of their rightful place as leaders of the entire Muslim world against the usurping, pro-Sunni Abbasids, whom they were determined to overthrow and replace.
In line with this imperial vision, following the establishment of their rule in Ifriqiya, the next objective was Egypt, the gateway to the Levant and Iraq, the seat of their Abbasid rivals. In 914, a first invasion under the Fatimid heir-apparent al-Qa'im bi-Amr Allah was launched eastwards. It captured Cyrenaica (Barqa), Alexandria and the Fayyum Oasis, but failed to take the Egyptian capital, Fustat, and was driven back in 915, following the arrival of Abbasid reinforcements from Syria and Iraq. A second invasion was undertaken in 919–921. Alexandria was again captured, but the Fatimids were repelled in front of Fustat and their navy was destroyed. Al-Qa'im moved to the Fayyum Oasis, but was forced to abandon it in the face of fresh Abbasid troops and to retreat over the desert to Ifriqiya.