Almost directly across the Nile from Cairo was Memphis, an ancient Egyptian capital. Babylon, a Roman fortress city, occupied what is now a SE section called Old Cairo. Cairo itself was founded in 969 by the Fatimid general Jauhar Al Rumi to replace nearby Al Qatai (established in the 9th cent. by an Abbasid governor of Egypt) as the capital of Egypt. In the 12th cent. Saladin ended Fatimid rule and established the Ayyubite dynasty (1171–1250). To defend the city against Crusaders, Saladin erected (c.1179) the citadel, which still stands, and extended the walls of the city, parts of which remain. Cairo prospered under the rule of the Mamluks, who added many buildings of artistic merit, but the city declined after it was conquered (1517) by the Ottoman Empire.
At the time of its capture (1798) by Napoleon Bonaparte's forces, the city had about 250,000 inhabitants. British and Turkish forces ousted the French in 1801, and Cairo was returned to Ottoman control. Under Muhammad Ali (ruled 1805–49), it became the capital of a virtually independent country and grew in commercial importance; many Europeans settled in the city. During World War II, Cairo was the Allied headquarters and supply center for the Middle East and the site (1943) of the Cairo Conference. The Arab League is headquartered in Cairo. In the late 20th cent. the city has been plagued by poverty and overcrowding, which has forced many Cairenes to settle in the City of the Dead, a vast expanse of cemeteries to the S and E; the area is not administered or serviced by the city.