Shawar was born in 1110 in Egypt to a Shia Muslim family, and he was the emir of the as-Sa'di Duchy in Alexandria and Governor of Upper Egypt under the Fatimid Caliphate. The ambitious Shawar sought to seize power for himself, and he allied with Sultan Nur ad-Din of Damascus against the Fatimids. In 1162, he overthrew and assassinated Dirgham and became the new vizier of the caliphate, but he argued with Nur ad-Din's general Shirkuh, leading to war with the Zengids. Shawar allied with the crusaders under King Amalric I of Jerusalem against the Turks, leading to a Zengid invasion of Egypt. In the following years, Shawar frequently switched sides between the Kingdom of Jerusalem and the Zengids, ending when he gained Shirkuh's assistance in repelling the crusaders in 1169. However, Shirkuh decided to execute the untrustworthy Shawar rather than restore him to power, and Shirkuh became the new vizier.