استطاع الفاطميون أن يؤسسوا دولة في افريقية بعد أن نجحوا في القضاء على إمارة الأغالبة التي حكمت افريقية باسم العباسيين أكثر من قرن من الزمن – سنة 296 هـ. سعى الخلفاء الفاطميون الأوائل لفتح مصر وجعلها مركزا لدولتهم الناشئة؛ لأن بلاد المغرب كثيرة الاضطرابات والثورات، ولتحقيق ذلك بدأوا في إرسال الحملات إلى مصر منذ خلافة الخليفة الفاطمي الأول المهدي وذلك في السنوات 301هـ ، 306، 321، لكنها اخفقت في تحقيق مسعاها وإن كانت قد نجحت في ضم اقليم برقة للفاطميين سنة 301هـ. انشغل الخلفيتان القائم 322- 334 هـ وابنه المنصور 334-341 ه بإخماد ثورات الخوارج في المغرب عن محاولة فتح مصر. لما تولى المعز خلافة الفاطميين 341- 365 هـ. سعى في مد سلطانة من برقة شرقا حتى المحيط الاطلسي غرباً، ثم بدأ في الاستعداد لفتح مصر التي كانت تعاني حينها من ضعف سياسي تحت حكم الاخشيديين، كما أنها تدهورت اقتصادياً بسبب قصور فيضان النيل، وتوالى سنوات المجاعات والأوبئة، فعمت فيها الفوضى والفتن، والحروب بين الجُند، بالإضافة إلى ضعف الخِلافة العباسية في تلك المرحلة، وأمام هذا الوضع بدأ الخليفة المُعز الفاطمي في الاستعداد لفتح مِصر في عام 355 هـ.The Fatimids were able to establish a state in Africa after they succeeded in eliminating the Emirate of Aghlabib, which ruled Africa in the name of the Abbasids more than a century - in the year 296 AH. The first Fatimid caliphs sought to open Egypt and make it a center for their emerging state; Because the countries of Morocco are many turmoil and revolutions, and to achieve this, they started sending campaigns to Egypt since the succession of the first Fatimid caliph Al -Mahdi, in the years 301 AH, 306, and 321, but they failed to achieve their endeavors, even if it had succeeded in including the province of Barqa for the Fatimids in the year 301 AH. The two players, 322-334 AH, and his son Al-Mansour 334-341 AH, were busy extinguishing the Khariji revolutions in Morocco from the attempt to open Egypt. When Al-Moez took over the succession of the Fatimids 341-365 AH. He sought to extend Sultana from Burqa East to the Atlantic Ocean in the west, then began preparing to open Egypt, which was then suffering from political weakness under the rule of Akhashidis, as it deteriorated economically due to the failure of the Nile\u27s flooding, and the years of famine and epidemics continued, in which chaos, sedition, and wars prevailed between The soldiers, in addition to the weakness of the Abbasid caliphate at that stage, and in front of this situation, the caliph Moez Al -Fatimi began preparing to open Egypt in the year 355 AH