It was in the Tenth Century that the Abbasid Caliphate was again challanged. This time, the new leader was a Shiite who established his strong political and military platform in Tunisia and moved eastward. His legitimacy was supported by his claim of being a direct descendent of the Prophet Mohammed's (SAWS) daughter, Fatima. His name was Imaam Mo'iz le deenillah, he who strengthens the religion of Allah. In 969 AD, he sent his most skilled general Qaa'id Jawhar, on a campaign to capture Egypt.
On August 5, 969 AD, what remained of Al-Fustat was easily captured by Jawhar who decided to build a new capital. The Sicilian general did not know he had just founded a city that would survive for the next millenium. He did not know his city would grow to become one of the largest metropolitan areas in the world. He just knew he had laid the foundation for his new capital, Al-Mansuriyah, which Al-Mo'iz later renamed Al-Qaahira, Cairo, The Triumphant. The new capital was situated a couple of kilometers north of Al-Fustat, and was better protected by the Muqattam Hills. It had a small port on the Red Sea Canal, near today's Railway Station (At the time, the Nile was flowing further to the East, and changed its course over the years). And although it started as a private mansion for the Imaam-Caliph, its doors were open later for common citizens.
The rule of the Fatimids was one of the most brilliant in Egyptian history. Under Al-Mo'iz, the construction of al-Azhar University, one of the oldest in the world and still present to this day, began. His Caliphate is also acclaimed for the progress of learning and arts. He himself was a learned philosopher, scientist and astronomist. His court always remained full of jurists, traditionists, poets and historians.
His son, Al-Aziz, was a supporter of arts and astronomy, and was known to be a tolerant ruler and noble to his subjects. It was owing to his generous patronage that the University of al-Azhar could maintain itself as a unique and distinguished seat of Islamic learning. Al-Azhar contained a huge library. The royal library of al-Aziz itself contained 200,000 rare manuscripts and an equal number of manuscripts were kept at al-Azhar. It also contained 2400 illuminated copies of Holy Koran. During Al-Aziz's 20-year rule, bridges, palaces, and mosques were built, and canals were dug out. Al-Aziz was also known for his paternal care of the people and introduced many financial reforms in the country. He introduced the system of paying a fixed stipends for services to the official and household servants and also used to give them robes and mules to ride on. Among his outstanding reforms, the most significant was that he put down bribery and corruption with a firm hand in Egypt.
But the rule of Al-Haakim, Al-Aziz's son and successor was quite a distinct story. Al-Haakim, however assumed full power of the empire at the age of fourteen, and thus it does not appear to have affected his early education. He had a good command of Arabic tongue, and a fine knowledge of poetry at an early age. He would frequently pause in the streets of his capital to exchange greetings or answer questions from his poor subjects. Al- Haakim wished, above all, to be the perfect ruler; widely generous, enforcing strict good order, and absolutely just to all the people. Personally, he avoided all luxury and mounted a simple donkey for his excursions. Imam al-Haakim delivered his first speech from the pulpit of a mosque in Cairo on 386/996 and said: "O'people, surely Allah has made us superior by the word of Imaamat. He has eternalized it in us, so that it may last until the day of doom. The one of us receives it from the other and the son inherits it from the father. This is the bounty of Allah, He gives it to whomever He wishes, and God is of bounty abounding."
Al-Haakim was succeeded by Al-Zaher who seems to have inherited a lot from his father. He acceded on the throne of Fatimid Caliphate and Imaamat on 411/1021 at the age of 16 years. On the occasion of his coronation, a special payment in excess (fazl) of 20 dinars was granted to each soldier. Things remained better in the beginning of Al-Mustansir's rule, he ascended on 15th Shaban, 427/June 13, 1036 at the age of 7 years. During the early years, the state affairs were administered by his mother. His period of Caliphate lasted for 60 years, the longest of all the caliphs, either in Egypt or elsewhere in Islamic states. Between 457/1065 and 464/1072, the famine made the condition of Egypt from bad to worse. Meanwhile, in 454/1062 and again in 459/1067, the struggle between the Turkish and Sudanese soldiery deteriorated into open warfare, ending in a victory for the Turks and their Berber allies. The Berbers in lower Egypt deliberately aggravated the distress by ravaging the country, destroying the embankments and canals, and seeking every way to reduce the capital and the neighboring districts by sheer starvation.
In al-Mustansir's stable where there had been ten thousand animals there were now only three thin horses, and his escort once fainted from hunger as it accompanied him through the streets. As long as the calamity lasted, al-Mustansir alone possessed a horse, and, when he rode out, the courtiers followed on foot, having no beast to carry them. The condition of the country deteriorated with the protracted famine that followed by plague, and the whole districts were absolutely denuded of population and house after house lay empty. The precious library which had been rendered available to the public and was one of the objects for which many visited Cairo was scattered, the books were torn up, thrown away, or used to light fires.
When the situation slightly improved in 1073, Al-Mustansir, with the help of his new governor Badr ul-Jamaali, revived Cairo. It was then that the new gates were built: Baab-un-Nasr, Baab ul-Futooh, and Baab Zuweila. After Al-Mustansir's death, the Fatimid Dynasty rapidly crumbled, and it was less than a hundred years before one of the most powerful figures in Medieval history emerged to put an end to the Shiite rule of the Fatimids.