Having thus provided for the government of Ifrikiya al-Moʿizz then set out. Passing by Qabus, Tripoli, Ajdabiya, and Barqa, he reached Alexandria in the course of the spring, and there received the Qadi of Fustat and other officials. At the beginning of the summer he encamped in the gardens of the monastery at Giza, and there received Jawhar who came out to welcome him on his arrival. After resting a short time he made his solemn entry into the capital. Although Fustat was decorated ready for his coming, he paid it no visit, but marched straight to his palace in Kahira where he took up his abode. In this solemn entry the coffins of the three Khalifs who had been his predecessors were carried in the first ranks, escorted by two state elephants, and the Khalif himself rode surrounded by his four sons and other kinsmen. He entered the royal city by the “gate of the arch,” one of the two openings in the Bab az-Zuwayla. The other opening which no longer existed in Maqrizi’s time was generally regarded as unlucky. This bab is now commonly regarded as the mysterious dwelling place of the head of all the darwishes who, wherever he may be, is supposed to be able to fly in spirit to this abode, and there the spirit is placated. The legends connected with this gate seem to have varied from age to age, but it has always been regarded as haunted by mysterious presences.

Soon after taking up his abode in the royal palace, on the great feast day which terminates the fast of Ramadan, al-Moʿizz conducted prayers in the newly finished mosque of al-ʾAzhar which, it will be remembered, lay within the guarded precincts, and so was not accessible to the public. The mosque, commenced by Jawhar in 360, had been completed in 361. In 378 the following Khalif, al-ʿAziz, devoted it especially to the learned, and from this it has gradually become the leading university of Islam.

But al-Moʿizz was not able to remain as a sacred character in the seclusion of the guarded city, although that perhaps was his first intention. The Qarmatians were still threatening. Al-Moʿizz wrote to Hasan proposing negotiations, but the Qarmati chief merely replied, “I have received thy letter, full of words, but empty of sense: I will bring my answer.”

In the following spring the Qarmatians appeared again at ʿAyn Shams, and helped by Ikhshid partisans, spread far and wide through Egypt. Al-Moʿizz sent his son ʿAbdullah with some 4,000 men into Lower Egypt and he gained several minor advantages over some of the marauding bands of Qarmatians, but this did not prevent the main body from assembling before Jawhar’s trench which they prepared to assault. By means of spies the Khalif managed to bribe the Arab tribe of B. Tayy, the strongest factor in Hasan’s army, allies but not themselves of the Qarmatian sect, to desert, the price being 100,000 dinars. As the treasury did not contain sufficient gold these coins were specially struck of lead and gilt. In the next attack the B. Tayy rode away and Hasan was routed, his camp plundered, and some 1,500 of his irregular followers slain. The advantage was pressed home by the Egyptians who advanced into Syria, but after this defeat the Qarmatians began to fall to pieces as the result of internal disputes.

The defeat of the Qarmatians was followed by the appearance of a new danger in the person of the Turkish leader Haftakin. This man had been a slave in the service of the Buwayhid prince, Moʿizz ad-Dawla, and rose to a leading position in command of the Turkish mercenaries under his son Azz ad-Dawla Bakhtiar (Maq. ii. 9). In the course of a battle which took place outside Baghdad between the Turks and the Daylamites, Haftakin, though himself acting with exemplary courage, was deserted by most of his men and compelled to flee with a small body of some 400 followers. At first he took refuge at Rabha on the Euphrates, but afterwards moved to Syria. The Syrian Arabs were alarmed at his approach, and appealed for help to Ibn Jaʿfar, the Fatimite governor of Damascus, who was easily convinced that Haftakin was acting on behalf of the ʿAbbasid Khalif of Baghdad, and so took the field against him. But the Emir of Aleppo sent a force under the eunuch Bashara to the help of Haftakin, and as soon as this became known the Arabs deserted Jaʿfar and went home. Bashara then escorted Haftakin to Aleppo (Abu l-Feda) or Emessa (Maqrizi), where the Emir received him well and bestowed on him many presents.

At Damascus Jaʿfar was faced with a discontented group of citizens, and they even formed themselves into armed bands under the leadership of one Ibn Maward. As soon as these men heard of Haftakin’s arrival in Syria, they opened negotiations with him and invited him to Damascus, promising to join him in expelling the Fatimid garrison and to recognise him as emir. Damascus, it must be remembered, was fanatical in its hatred of the Shiʿites. Haftakin agreed to these proposals, and towards the end of Shaban 364 proceeded as far as Thaniyyat al-Okab on the road to Damascus.

At this juncture Ibn Jaʿfar heard that the Greeks were intending to make an attack upon Tripoli in Syria, and so marched his forces out of Damascus to intercept them. This gave Haftakin his opportunity, and he was able to enter Damascus without opposition. After a brief stay there he went down to Baʿalbak to chastise the Arabs who had taken up arms to assist Jaʿfar against him, but was surprised by a large Greek force, which was pillaging Baʿalbak and laying waste the surrounding country: he was only just able to escape before them and seek safety in Damascus whither the Greeks soon followed him. The citizens sent out an embassy to ask for terms, and were informed that the city would be spared in return for a substantial fine. Soon Haftakin went out to the Greek camp and explained that he was unable to raise the promised fine because of the obstacles put in his way by Ibn Maward and his partisans, the free militia of Damascus. As a result of this the Greek Emperor, John Tzimisces, sent officers into the city, who arrested Ibn Maward and brought him out a prisoner. By this means the city was cleared of its irregular forces and Haftakin took full possession, raising the sum of 30,000 pieces of gold as a fine with great rigour. He paid the sum to the Greeks, who forthwith retired to Beirut and thence to Tripoli.

Thus Haftakin became absolute master of Damascus, and formally recognised the suzerainty of the ʿAbbasid Khalif of Baghdad. He was afraid, however, that the Fatimid Khalif would before long take steps to recover his hold over Syria, and so wrote to the Qarmatians at Lahsa, their headquarters in the Bahrayn, asking them to ally themselves with him against al-Moʿizz. They accepted these proposals and a large body of them arrived before Damascus in 365, where they encamped for a few days; after resting and conferring with Haftakin they passed on to Ramla, where the Fatimid general Ibn Jaʿfar was in command, and at their approach he retired to Jaffa, and they occupied Ramla. Meanwhile Haftakin, as agreed with the Qarmatians, marched along the coast, and at Saʿida (Sidon) engaged two subordinate Fatimite generals, Dhalim b. Marhub and Ibn ash-Sheikh, whom he defeated. Dhalim then withdrew to Tyre, and Haftakin had the hands of the slain of the Fatimite army cut off and sent as a trophy to Damascus (Maq. ii. 9).

Just about this time the Khalif al-Moʿizz died, his son ʿAbdullah having pre-deceased him. He had spent only two years in Egypt but, besides the decisive repulse of the Qarmatians, he had established a government, which on the whole was a fair one and kept good order in the land. To avoid racial disputes, such as had disturbed Kairawan, he settled his African troops at al-Khandaq near ʿAyn Shams and, although they were allowed to visit Fustat freely during the day, all were required to leave the city before nightfall. In dealing with the inhabitants of Egypt both al-Moʿizz and Jawhar put aside all prejudices, whether of race or religion, and took a simply practical attitude, at heart no doubt regarding all religions as equally worthless. The Copts were as a rule far more efficient as clerks, accountants, and scribes, than their Muslim fellow countrymen, and they, as well as some Greek Christians, were largely employed in all the subordinate branches of the administration, and even to rise to some of the higher offices. As a practical measure this was thoroughly satisfactory, but the fact that the tax collectors and practically all the finance officials were Christians or Jews, caused the gradual evolution of a strong feeling of dislike against members of these two religions. Undoubtedly also the methods of oriental finance gave opportunity for much oppression and dishonesty, and the Copts and Jews were unable to avoid these temptations, so that much of the prejudice felt against them was justified. Although the employment of Christians and Jews in the civil service is more or less an established tradition in Muslim lands, it was carried much further by the Fatimids than had been usually the case.

Al-Moʿizz entrusted the task of organising a new system of taxation to the converted Jew, Ibn Killis, who had had experience of administrative work under Kafur, and to ʿAsluj. The old system of farming out the taxes was abolished and the whole was centralised, whilst at the same time a new assessment of land and taxable sources was made. All arrears were rigorously called up, but very careful consideration was given to every appeal and complaint. The whole system of taxation was strictly enforced, but efforts were made to protect the tax-paying community from unjust exactions. As a result the revenue of the state was considerably increased, the daily takings in the city of Fustat alone ranging between 50,000 and 120,000 dinars. At the same time, however, al-Moʿizz commenced an extravagant expenditure on the erection of the royal suburb of Kahira, and this was followed by ostentatious and luxurious outlay on an unprecedented scale, so that the actual financial position of the government was not much improved on the whole. A taste for display became a characteristic of the Fatimid dynasty, and this tended to exert a demoralising influence on the community generally by raising the general standard of expenditure.