Al-Afdal Shahanshah

Al-Afdal Shahanshah (; ; 1066 – December 11, 1121), born Abu al-Qasim Shahanshah bin Badr al-Jamali and surnamed al-Malik al-Afdal ("the excellent king"), was a vizier of the Fatimid caliphs of Egypt.
Ascent to power.
He was born in Acre, the son of Badr al-Jamali, an Armenian mamluk who became Muslim. Badr was vizier for the Fatimids in Cairo from 1074 until his death in 1094, when al-Afdal succeeded him. Caliph Al-Mustansir Billah died soon afterwards, and al-Afdal appointed as caliph al-Musta'li, a child, instead of al-Mustali's much older brother Nizar ibn al-Mustansir. Nizar revolted and was defeated in 1095; his supporters, led by Hassan-i Sabbah, fled east, where Sabbah established the Nizari Isma'ili sect, known also as the order of Assassins.
At this time Fatimid power in Palestine had been reduced by the arrival of the Seljuk Turks. In 1097 he captured Tyre from the Seljuks, and in 1098 he took Jerusalem, expelling its Artuqid governor Ilghazi in place of the Fatimid Iftikhar al-Dawla. Al-Afdal restored most of Palestine to Fatimid control, at least temporarily.
Conflict with the Crusaders.
Al-Afdal misunderstood the Crusaders as Byzantine mercenaries; this misperception caused al-Afdal to conclude that the Crusaders would make for natural allies, as each were enemies of the Seljuk Turks. Fatimid overtures for an alliance with the crusaders were rebuffed, and the crusaders continued southward from Antioch to capture Jerusalem from Fatimid control in 1099.
When it became apparent that the Crusaders would not rest until they had control of the city, al-Afdal marched out from Cairo, but was too late to rescue Jerusalem, which fell on July 15, 1099. On August 12, 1099, the Crusaders under Godfrey of Bouillon surprised al-Afdal at the Battle of Ascalon and completely defeated him. Al-Afdal would later reassert Fatimid control of Ascalon, as the Crusaders did not attempt to retain it, and utilize it as a staging ground for later attacks on the Crusader states.
When al-Musta'li died in December 1101, al-Afdal raised the five-year-old al-Amir bi-Ahkam Allah to the throne as imam and caliph. To further strengthen the familial ties with the young caliph, he married him to his own daughter. As the vizier, father-in-law, and uncle of the young ruler, al-Afdal placed the caliph before him on his own horse during al-Amir's inaugural procession. A decree, dictated by al-Afdal, renewed his appointment as vizier with plenipotentiary powers and ensured his ascendancy over the child-caliph. 
Al-Afdal marched out every year to attack the nascent Kingdom of Jerusalem, and in 1105 attempted to ally with Damascus against them, but was defeated at the Third Battle of Ramla. Al-Afdal and his army enjoyed success only so long as no European fleet interfered, but they gradually lost control of their coastal strongholds; in 1109 Tripoli was lost, despite the fleet and supplies sent by al-Afdal, and the city became the centre of the Crusader state of the County of Tripoli. In 1110 the governor of Ascalon, Shams al-Khilafa, rebelled against al-Afdal with the intent of handing over the city to Jerusalem (for a large price). Al-Khilafa was assassinated by his Berber troops, sending his head to al-Afdal.
Al-Afdal also introduced tax ("iqta"') reform in Egypt, which remained in place until Saladin took over Egypt. Al-Afdal was nicknamed "Jalal al-Islam" ("Glory of Islam") and "Nasir al-Din" ("Protector of the Faith"). Ibn al-Qalanisi describes him as "a firm believer in the doctrines of Sunnah, upright in conduct, a lover of justice towards both troops and civil population, judicious in counsel and plan, ambitious and resolute, of penetrating knowledge and exquisite tact, of generous nature, accurate in his intuitions, and possessing a sense of justice which preserved him from wrongdoing and led him to shun all tyrannical methods."
Final years and assassination.
In 1115, an assassin tried to kill al-Afdal, but he was saved by his bodyguards. While he was not harmed, his health deteriorated from that time, leading to assigning his brother Ja'far the task of adding the official, calligraphic signature to documents, while in 1115, he designated his son, Sama al-Mulk, as his deputy (and thus heir-apparent). Following another failed attack by three assassins in 1118, al-Afdal suspected his own sons, and had them deprived of their positions and incomes.
On 13 December 1121, during a procession on the last day of Ramadan, al-Afdal was assassinated. The deed was commonly attributed to (and claimed by) the Nizari Order of Assassins. However, the contemporary Syrian chronicler Ibn al-Qalanisi states that the murder was the work of the Caliph al-Amir, and of al-Afdal's chief of staff, al-Ma'mun al-Bata'ihi, who would succeed him as vizier. Modern scholars commonly accept the Assassins' responsibility for the deed, apparently as revenge for Nizar's death, but whatever his true role in his master's death, al-Bata'ihi moved quickly to take control of the situation. He took his master's body to the vizieral palace and delayed the announcement of his death until al-Amir could be notified. On the morning of the next day, Eid al-Fitr, al-Amir appointed al-Bata'ihi as vizier and publicly reasserted his position as head of the state by presiding at the day's ceremony. Al-Afdal's adult sons were imprisoned, but the other members of al-Afdal's family, to whom after all the caliph himself was related, were allowed to partake in the ceremony, and al-Afdal received a funeral and burial appropriate to his station. At the same time, al-Amir moved quickly to confiscate al-Afdal's enormous wealth, houses, and estates, and brought the moveable items to his own palace. So great was the treasure amassed by al-Afdal that chroniclers describe it as larger than that of any previous king, and it took forty days to move it to the caliph's palace.