At this desperate juncture when these troubles were brewing, al-Mustansir was roused to action and sent a message to Badr al-Jamali, the then governor of Acre, inviting him to come to Egypt and take control. Badr al-Jamali responded swiftly. Originally an Armenian slave of the Syrian amir, Jamaluddin bin Ammar, he had a successful career as soldier and governor in Syria. His Armenian soldiers were loyal and reliable and he insisted on taking them with him to Egypt. Sailing from Acre in the mid-winter, he landed at Damietta and entered Cairo on 28th Jamada I, 466/January 29, 1074. Badr al-Jamali took the charge and dealt the state affairs efficiently. The swift and energetic actions of Badr al-Jamali brought peace and security to Egypt, and even measure of prosperity. The annual revenue was increased from about 2,000,000 to 3,00,000 dinars. It is true that his efforts were greatly assisted by the fact that the year 466/1074 saw an exceptionally good Nile, so that prosperity and abundance once more reigned through the land.
The foremost priority being given by al-Mustansir was to rebuild the library devasted by the Turks. De Lacy O'Leary writes in "A Short History of the Fatimid Khalifate" (London, 1923, p. 207) that, "It is interesting to note that the Khalif set himself to the formation of a new library at Cairo as one of his first tasks; it helps us to realize that the Shiites were then as always the friends of learning."
In sum, Badr al-Jamali was invested the triple title, viz. Amir al-Juyush (commander of the army), Badi al-Duat (director of the missionaries) and the Vizir. It is however by the first of these three titles that he is usually known.