There was a race for the possession of the country between Nureddin's lieutenant Shirguh or Shirkuh and Amalric I., the brother and successor of Baldwin III.; and in the race Shirkuh proved the winner.
Into the vicissitudes of the fight it is not necessary here to enter; but in the issue Nureddin won, in spite of the support which Manuel gave to Amalric. Nureddin's Kurdish lieutenant, Shirguh, succeeded in establishing in power the vizier whom he favoured, and finally in becoming vizier himself (January 1169); and when he died, his nephew Saladin (Sala-ed-din) succeeded to his position (March 1169), and made himself, on the death of the caliph in 1171, sole ruler in Egypt.
For some five years a contest was waged between Amalric and Shirguh (Shirkuh), the lieutenant of Nureddin, for the possession of Egypt.
Thrice (1164,1167,1168) Amalric penetrated into Egypt: but the contest ended in the establishment of Saladin, the nephew of Shirguh, as vizier - a position which, on the death of the puppet caliph in 1171, was turned into that of sovereign.
Shawar, being unable to cope with the Syrians, demanded help of the Frankish king of Jerusalem Amalric (Amauri) I., who hastened to his aid with a large force, which united with Shawars and besieged Shirgflh in Bilbeis for three months; at the end of this time, owing to the successes of Nureddin in Syria, the Franks granted Shirguh a free passage with his troops back to Syria, on condition of Egypt being evacuated (October 1164).
Rather more than two years later Shirguh persuaded Nureddin to put him at the head of another expedition to Egypt, which left Syria in January 1167, and, entering Egypt by the land route, crossed the Nile at Itfib (Atfih), and encamped at Giza; a Frankish army hastened to Shgwars aid.
At the battle of Babain (April 11th, 1167) the allies were defeated by the forces commanded by ShIrguh and his nephew Saladin, who was Sala din presently made prefect of Alexandria, which surrendered to Shirguh without a struggle.
Saladin was soon besieged by the allies in Alexandria; but after seventy-five days the siege was raised, Shirguh having made a threatening movement on Cairo, where a Frankish garrison had been admitted by Shgwar.
The caliph, who up to this time appears to have left the administration to the viziers, now sent for Shirguh, whose speedy arrival in Egypt caused the Franks to withdraw.
After two months ShIrguh died of indigestion (23rd of March 1169), and the caliph appointed Saladin as successor to Shirgflh; the new vizier professed to hold office as a deputy of Nureddin, whose name was mentioned in public worship after that of the caliph.