had not paid the yearly tribute that had begun during the reign of Baldwin III. The vizier, Dirgham, had recently overthrown the vizier Shawar, and 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. Amalric returned home but Shawar fled to the court of Nur ad-Din, who sent his general Shirkuh to settle the dispute in 1164. In response Dirgham sought help from Amalric, but Shirkuh and Shawar arrived before Amalric could intervene and Dirgham was killed. Shawar, however, feared that Shirkuh would seize power for himself, and he too looked to Amalric for assistance. Amalric returned to Egypt in 1164 and besieged Shirkuh in Bilbeis until Shirkuh retreated to Damascus. Amalric could not follow up on his success in Egypt because Nur ad-Din was active in Syria, having taken Bohemund III of Antioch and Raymond III of Tripoli prisoner at the Battle of Harim during Amalric's absence. Amalric rushed to take up the regency of Antioch and Tripoli and secured Bohemund's ransom in 1165 (Raymond remained in captivity until 1173). The year 1166 was relatively quiet, but Amalric sent envoys to the Byzantine Empire seeking an alliance and a Byzantine wife, and throughout the year had to deal with raids by Nur ad-Din, who captured Banias. In 1167, Nur ad-Din sent Shirkuh back to Egypt and Amalric once again followed him, establishing a camp near Cairo; Shawar again allied with Amalric and a treaty was signed with the caliph al-Adid himself. Shirkuh encamped on the opposite side of the Nile. After an indecisive battle, Amalric retreated to Cairo and Shirkuh marched north to capture Alexandria; Amalric followed and besieged Shirkuh there, aided by a Pisan fleet from Jerusalem. Shirkuh negotiated for peace and Alexandria was handed over to Amalric. However, Amalric could not remain there indefinitely, and returned to Jerusalem after exacting an enormous tribute. Byzantine alliance After his return to Jerusalem in 1167, Amalric married Maria Comnena, a great-grandniece of Byzantine emperor Manuel I Comnenus. The negotiations had taken two years, mostly because Amalric insisted that Manuel return Antioch to Jerusalem. Once Amalric gave up on this point he was able to marry Maria in the Cathedral of Tyre on August 29, 1167. During this time the queen dowager, Baldwin