Muhammed Ali was appointed as the Ottoman Viceroy of Egypt in 1805, by the Sublime Porte. He commissioned this mosque, which was built between 1830 and 1848, and is situated on a 12th century citadel built by Salah-el-din al Ayyubi, the Kurdish military leader who ruled over Egypt and who defeated Richard the Lionheart in the second Crusade.
In the early years of his rule, Muhammed Ali’s power was contested by the Mamluks, the slave warrior caste of the Ottoman empire who had ruled Egypt since the mid-13th century, and whose army had been defeated by Napolean in 1798.
In 1811, he invited the Mamluk amirs to the citadel under the pretense of a banquet, and ambushed and massacred them as they arrived. Legend has it that one amir escaped the ambush, and jumped onto a horse, on which he leapt – most likely to his doom – over the citadel’s walls.