TLDR Imamat History: Northwest Africa
Imam Muhammadin alMahdi
Muhammadin alMahdi became the Imam at only 8 years old. After the death of his father, he was placed in the care of his uncle, Said alKhair, and eventually married alKhair's daughter. Muhammadin alMahdi continued his father's guise of being a merchant from Jordan in order to stay on good terms with the local government. Before he could be exposed, he decided to head to Yemen to oversee the founding of an Ismaili State. On the way, he stopped in Egypt and decided to establish his state in North Africa, instead. The Abbasid Caliph ordered the arrest of Muhammadin alMahdi in Egypt, but a high ranking government official, who happened to be Ismaili, tipped alMahdi off and he was able to escape to Tripoli and then Sijilmasa, Morocco, where he was arrested. Dai Abdullah alShii, who was initially instructed to go to Yemen to help establish the Ismaili State met up with the Kutama tribe in Mecca, on his way to Egypt. The Kutama had already been visited by Jafar asSadiq's Dais, and gave their allegiance to Dai alShii and helped him to conquer North Africa on the way to free Muhammadin alMahdi. The governor of Sijilmasa fled as soon as he heard about Dai alShii and his Kutama army. alMahdi and alShii established the Fatimid Empire in Raqqada, Tunisia, and with the help of their Kutama and Ismaili troops, began their conquest of North Africa. They quickly conquered Tunisia and Sicily, establishing the towns of Mahdia and Muhammedia (both in Morocco), but Muhammadin alMahdi had his sights set on Egypt. As part of his devotion, alShii relinquished all his military success to the Imam, giving him credit for his own accomplishments, and rule over the land he conquered. This didn't sit well with alShii's two brothers and they plotted against the Imam, eventually convincing alShii to turn against his leader. When Muhammadin alMahdi learned of this, he had all three brothers killed but, to honor alShii's accomplishments before the treachery, gave him a public burial with honors. After Muhammadin alMahdi's own funeral, his death was publicized for three months, this way no one could impersonate the secretive Imam.
Abu alQasim Muhammad alQaim biAmrillah was born in Salamiyah, while his father was still posing as a merchant. While Imam alMahdi was the first Fatimid Caliph, alQaim suppressed a number of uprisings within the young empire. He also carried out two invasions of Egypt for his father, both of which failed. After he became Imam/Caliph, he sent his army under the command of Raydan for another unsuccessful invasion of Egypt. He did successfully quell a few more uprisings, including one lead by Ibn Talut, who falsely claimed to be the the son of Imam alMahdi and heir to the Fatimid Empire, and Abu Yazid, from the Zanata tribe of Sudan. The Zanata were enemies of the Kumata and were converted to Khwarij (the Muslims that betrayed Imam Aly because of his arbitration with Muawia). Abu Yazid conquered Fatimid cities such as Beja, Raqqada, and Kairouan (all in Tunisia), eventually laying siege to Mahdia, where alQaim died. alQaim's death was kept secret until Abu Yazid's revolt was over.
Abu Tahir Ismail alMansoor Billah was born and raised during a tumultuous time of the Fatimid Empire and took over the Imamat/Caliphate during Abu Yazid's revolt. Because Mahdia had prepared stockpiles of food and supplies before Abu Yazid had reached, they could outlast the siege, sending Abu Yazid's exhausted troops to Sousse. alMansoor attacked the weakened army in Susa and pushed them back to Morocco. Abu Yazid didn't stop attacking the Ismailis until he was injured and arrested in Fort Kutama in Algeria. Abu Yazid later died in prison and alMansoor gave him a respectful burial as an honorable enemy. alMansoor continued to quell various uprisings, including a Fatimid civil war in Sicily between the Arabs and the Berbers.