vizier, who had fled to Syria called Nur ad-Din for support in reinstating him to his former position as the de facto ruler of Egypt against the new vizier, Dirgham. Dirgham attempted to thwart his rival's plans by opening negotiations with Nur al-Din for an alliance against the Crusaders, but the Syrian ruler's reply was non-committal, and on his way to Egypt, Dirgham's envoy was arrested by the Crusaders, possibly on the instigation of Nur al-Din himself. First Crusader invasion, 1163 In 1163, King Amalric went to invade Egypt, claiming that the Fatimids had not paid the yearly tribute that had begun during the reign of Baldwin III. The vizier, Dirgham, who had recently overthrown the vizier Shawar, marched out to meet Amalric at Pelusium, but was defeated and forced to retreat to Bilbeis. The Egyptians then opened up the Nile dams and let the river flood, hoping to prevent Amalric from invading any further, thus he returned home. However, Dirgham preferred to negotiate with Amalric, offering him a peace treaty guaranteed by the surrender of hostages, and the payment of an annual tribute. Meanwhile, Nur ad-Din agreed to support Shawar who offered to hand over one third of the annual land tax (kharāj) revenue to Nur al-Din. The latter manoeuvred to attract the Crusaders' attention away from the expeditionary force, as his general Shirkuh accompanied by his nephew, Saladin, crossed the lands of the Kingdom of Jerusalem to enter Egypt. Dirgham appealed to Amalric for help, but the King of Jerusalem was unable to intervene in time, and in late April 1164, the Syrians surprised and defeated Dirgham's brother Mulham at Bilbeis, opening the way to Cairo. In May 1164, Shawar became vizier of Egypt, and Dirgham was killed, after he had been abandoned by the people and the army. Shawar was, however, a mere figurehead to Nur ad-Din, who had installed Shirkuh as ruler of Egypt. Shawar became unsatisfied with this and called upon the enemy of the Sunni Muslims, King Amalric I of Jerusalem. Second Crusader invasion, 1164 Shawar then argued with Shirkuh, and allied with the Crusader king, Amalric I, who attacked Shirkuh at Bilbeis, in August–October 1164. The siege ended with a stalemate, and both Shirkuh and Amalric agreed to withdraw from Egypt. In the meantime, Nur ad-Din moved his forces against the Crusader state of Antioch and despite being a Byzantine protectorate, defeated and