In 1176 Salah ad-Din, the sultan who would later retake Jerusalem, began a fortress on a spur of the Muqattam hills overlooking Cairo. He wanted a stronghold safe from the Crusaders and from rivals within the city. Its walls and towers were built partly with stones taken from small pyramids at Giza.
From the 13th century to the 19th century, the Citadel was the seat of government of Egypt, home to Mamluk sultans and Ottoman governors. In 1811 Muhammad Ali Pasha invited the Mamluk leaders to a feast here and had them killed, taking full control of Egypt.
Muhammad Ali then built the huge domed mosque, finished in 1848, that gives the Citadel its famous outline. The Citadel is part of Historic Cairo, a UNESCO World Heritage Site since 1979.
