The Fatimids (969-1171) were the only Shietes who ever ruled Egypt. They were called as such since they claimed descent from Fatimah (the daughter of the Prophet Mohammed) and Ali the fourth Khalif. The Ikhshidid dynasty began to weaken after Kafur's death. This incited the Fatimids to invade Egypt. Fatimids claim their descent from Prophet Mohamed through his daughter, Fatima. The Fatimids followed the Shi'ite belief in 909 in present-day Tunisia. In 968 under the caliphate of Al-Muezz, A Fatimid army headed by General Gawhar Al-Sekelli (the Sicilian) commanded the invasion of Egypt. Symbolizing the change of the rule, Gawhar managed to build a new capital called "Al-Qahera," after planet "mars." The name also means "vanquisher" in Arabic language. It was corrupted by European merchants to the name "Cairo," the same capital of our present-day. In 970, the Fatimids built the great mosque of Al-Azhar, which is also named after the Prophet's daughter, Fatima Al-Zahra'. Fatimids gained control, in short time, over holy cities of Mecca and Medina. They also annexed Palestine but had to confront the Byzantine forces there. Realizing the strategic importance of Egypt, the Fatimid caliph decided to shift the caliphate seat from Tunisia to the new Arab capital of Cairo.The Fatimids were not concerned with converting the population to the Shi'ite sect. They were also tolerant enough to employ Sunnis , Christians and Jews in the government. In 975 Al-Muezz died and was succeeded by Al-Aziz Billah. Al- Aziz's rule was characterized by an excellent administration that ran Egypt so effectively. This gave him a good opportunity to prosper Cairo with foundations, thanks to his witted vizier , ibn Killis. The kingdom continued despite the existence of other strong rival kingdoms. To strengthen the army, the Fatimids continued to import Turkish and Sudanese mercenaries. Al-Aziz died in 996 AD and was succeeded by his 11-year old son, Al-Hakim. Al-Hakim was an enigma. He had an extraordinary eccentric character. He was renown by issuance of very strange laws. He had all dogs of Cairo killed in 1004. He had a special passion to the dark so he ordered shops to open at night and close in daylight. Al-Hakim also forbade the selling of grapes, wine, beer, meloukhia (Jew's mallow) and even ordered the pouring of honey in the Nile. For some reason, he disliked women and consequently barred them from being seen in public and forbade shoemakers from making them shoes. Despite these all, Al-Hakim had positive sides. In 1005, he founded The Wisdom House (Beit Al-Hekma), as a center for learning science and theology. The center expanded and became a good place for scholars to meet and discuss their subjects. In his reign, a peace treaty was also forged with the Byzantine Empire in 1001 AD. He also managed to survive a severe famine that hit Egypt in 1007 AD. In 1017 AD, a vizier of Al-Hakim called Darazi claimed that Al- Hakim is an incarnation of God. To Egyptians, that was the last straw. They were shocked by the theory and started to make fun of their sort-of-a-mad caliph. The dispute between Al-Hakim and the populaces resulted in a breakout of a rebellion in 1020. As a result, Al-Hakim sent black troops to put down the unrest and to even burn the city of Al-Fustat. In 1021, Al-Hakim, who used to wander alone on his donkey in the Muqattam hills, disappeared during one of his rides. His body was never found and he is presumed to have been murdered by his sister, Set El-Molk, and other conspirators. The Fatimids began to lose their territories due to the internal crisis. Furthermore, a severe power struggle took place between the Turkish and Sudanese regiments of the army. Turkish troops plundered the treasury and the caliph's huge library of 100'000 books was dispersed. In an attempt to restore order, the caliph sent for Badr El-Gamali, a Fatimid ruler of Acre in Palestine to come to Cairo. Upon his arrive in 1074, Badr Al-Gamali aggressively crushed the army dissidents. He then united Egypt successfully under his control. After cleaning up the state, Egypt began to prosper again. Badr called for his architects and builders to thicken the walls of Cairo and build new gates, like Bab El-Fetouh, Bab El-Nasr and Bab Zuweila. Many of these constructions are still visible in Cairo nowadays. In 1094, both the caliph and his able general died. Following their death, six Fatimid caliphs ruled to the end of the dynasty in 1171 AD. Their rule was characterized by power struggles with viziers. The weak caliphs allowed many of the court members to control the government. The vacuum in the reign facilitated victories of the first crusade in 1099 that targeted the Holy Land in Palestine. Crusaders seized Jerusalem and continued to expand their empire and in 1118 they launched their first unsuccessful attack on Egypt. At the end of the Fatimid rule, a vizier called Shawar, sought help from ruler of Damascus, Nour El-Din, in order to regain the reign after being displaced by a rival. The Damascus ruler sent several campaigns headed by commander Sherkouh. Eventually, Shawar succeeded to seize back his seat but when he turned against Damascus, he began to contact the crusaders in Jerusalem seeking help from them. Sherkouh, who became an enemy to Shawar, launched a successful campaign in 1169 ousting Shawar and placing himself in rule only short time before his own death in the same year. The Fatimid caliph appointed Salah El-Din Al-Ayyubi, who was a general from Damascus and Sherkouh's nephew, as his vizier. Salah El-Din was a Sunni Moslem so he began founding schools to teach the Sunni doctrine to Egyptians. The pace was welcomed of Moslem Egyptians because the majority of them remained Sunnis during the reign of Fatimids. Salah El-Din, known as Saladin to the West, went far beyond this by dropping the name of the caliph from mosque prayers. The caliph was too weak and ill to realize what was happening as Saladin was actually deposing him. In 1171, the last Fatimid caliph died, ending the only Shi'ite dynasty that ever ruled Egypt. During the Fatimids' Period, the Crusaders came to in the Middle East and started occupying a great part of the Arab lands. The two ruling dynasties that followed the Fatimids as rulers of Egypt were the Ayyubids and the Mamluks. They were the rulers who carried the responsibility of fighting the Crusaders.