Islamic Cairo (), or Medieval Cairo, officially Historic Cairo (القاهرة التاريخية el-Qāhira tārīkhiyya), refers mostly to the areas of Cairo, Egypt, that were built from the Muslim conquest in 641 CE until the city's modern expansion in the 19th century during Khedive Ismail's rule, namely: the central parts within the old walled city, the historic cemeteries, the area around the Citadel of Cairo, parts of Bulaq, and Old Cairo () which dates back to Roman times and includes major Coptic Christian monuments.

The name "Islamic" Cairo refers not to a greater prominence of Muslims in the area but rather to the city's rich history and heritage since its foundation in the early period of Islam, while distinguishing it from with the nearby Ancient Egyptian sites of Giza and Memphis. This area holds one of the largest and densest concentrations of historic architecture in the Islamic world.

History

The foundation of Fustat and the early Islamic era

thumb|The excavated remains of Fustat in 2009|alt=|left

The history of Cairo begins, in essence, with the conquest of Egypt by Muslim Arabs in 640, under the commander 'Amr ibn al-'As. Perhaps even more importantly, the location of Fustat at the intersection of Lower Egypt (the Nile Delta) and Upper Egypt (the Nile Valley further south) made it a strategic place from which to control a country that was centered on the Nile river, much as the Ancient Egyptian city of Memphis (located just south of Cairo today) had done. He became governor of Egypt in 868 but quickly became its de facto independent ruler, while still acknowledging the Abbasid caliph's symbolic authority. He grew so influential that the caliph later allowed him to also take control of Syria in 878.thumb|[[Al-Azhar Mosque, founded by the Fatimids in 972. (The minarets were added later during the Mamluk period.)]]The city was located northeast of Fustat and of the previous administrative capitals built by Ibn Tulun and the Abbasids. Jawhar organized the new city so that at its center were the Great Palaces that housed the caliphs, their household, and the state's institutions.

Al-Mu'izz, and with him the administrative apparatus of the Fatimid Caliphate, left his former capital of Mahdia, Tunisia, in 972 and arrived in Cairo in June 973. A few strong viziers, acting on behalf of the caliphs, managed to revive the empire's power on occasion. The Armenian vizier Badr al-Jamali (in office from 1073–1094) notably rebuilt the walls of Cairo in stone, with monumental gates, the remains of which still stand today and were expanded under later Ayyubid rule. In 1099 the First Crusade captured Jerusalem, and the new Crusader states became a sudden and serious threat to Egypt. New Muslim rulers such as Nur al-Din of the Turkish Zengid dynasty took charge of the overall offensive against the Crusaders.

In the 12th century the weakness of the Fatimids became so severe that under the last Fatimid Caliph, al-'Adid, they requested help from the Zengids to protect themselves from the King of Jerusalem, Amalric, while at the same time attempting to collude with the latter to keep the Zengids in check. Eventually, Salah ad-Din (Saladin), a Zengid commander who was given the position of al-'Adid's vizier in Cairo, declared the end and dismantlement of the Fatimid Caliphate in 1171. Cairo thus returned to Sunni rule, and a new chapter in the history of Egypt, and of Cairo's urban history, opened.

Cairo's ascendance in the Ayyubid and Mamluk periods

thumb|The [[Cairo Citadel|Citadel of Salah ad-Din (Saladin), founded in 1176 and further developed by other rulers after him. The 19th-century Mosque of Muhammad Ali is visible overlooking its walls.|left]]

Salah ad-Din's reign marked the beginning of the Ayyubid dynasty, which ruled over Egypt and Syria and carried forward the fight against the Crusaders. He also embarked on the construction of an ambitious new fortified Citadel (the current Citadel of Cairo) further south, outside the walled city, which would house Egypt's rulers and state administration for many centuries thereafter. This ended Cairo's status as an exclusive palace-city and started a process by which the city became an economic center inhabited by common Egyptians and open to foreign travelers.

Under the reign of the Mamluk sultan al-Nasir Muhammad (1293–1341, including interregnums), Cairo reached its apogee in terms of population and wealth. Despite being a largely military caste, the Mamluks were prolific builders and sponsors of religious and civic buildings. An extensive number of Cairo's historical monuments date from their era, including many of the most impressive. By the late 15th century Cairo also had high-rise mixed-use buildings (known as a rab, a khan or a wikala, depending on exact function) where the two lower floors were typically for commercial and storage purposes and the multiple stories above them were rented out to tenants.

Cairo as a provincial capital of the Ottoman Empire

thumb|upright=0.8|Traditional residences in Cairo fronted by [[Mashrabiya|mashrabiyya windows (1867 photo)|alt=]]

Egypt was conquered by the Ottoman Empire in 1517, under Selim I, and remained under Ottoman rule for centuries. During this period, local elites fought ceaselessly among themselves for political power and influence; some of them of Ottoman origin, others from the Mamluk caste which continued to exist as part of the country's elites despite the demise of the Mamluk sultanate. It is one of the largest mosques in Cairo and is often cited as one of the most beautiful.

One of the most important and lasting institutions founded in the Fatimid period was the Mosque of al-Azhar, founded in 970 AD, which competes with the Qarawiyyin in Fes for the title of oldest university in the world.

Walls and gates

thumb|Part of the preserved Fatimid northern wall near Bab al-Futuh, built in the late 11th century

When Cairo was founded as a palace-city in 969 by the Fatimid Caliphate, Gawhar al-Siqilli, a Fatimid general, led the construction of the city's original walls out of mudbrick. Later, during the late 11th century, the Fatimid vizier Badr al-Gamali ordered a reconstruction of the walls primarily out of stone and further outward than before to expand the space within Cairo's walls. A restoration project from 2001 to 2003 successfully restored the three gates and parts of the northern wall between Bab al-Nasr and Bab al-Futuh. or 1171.

Citadel

Salah ad-Din began the construction of an extensive Citadel in 1176 to serve as Egypt's seat of power, with construction finishing under his successors. It is located on a promontory of the nearby Muqattam Hills overlooking the city. The Citadel remained the residence of the rulers of Egypt until the late 19th century, and was repeatedly transformed under subsequent rulers. Notably, Muhammad Ali Pasha built the 19th-century Mosque of Muhammad Ali which still dominates the city's skyline from its elevated vantage point. The famous Khan al-Khalili is a famous souq and commercial hub which also integrated caravanserais. In addition, thefts of Islamic monuments and artifacts in the Al-Darb al-Ahmar district threaten their long-term preservation. In the aftermath of the 2011 uprising theft increased among historic monuments and a lack of zoning enforcement allowed traditional houses to be replaced with high-rise buildings. Thefts and illegal constructions have since decreased, but environmental problems remain. Around the same period, another initiative launched by the AKTC focused on revitalizing the Al-Darb al-Ahmar neighbourhood following the construction of the nearby al-Azhar Park. This project aimed for a more bottom-up approach to improve the community's urban fabric and the socioeconomic situation of residents, as well as involving more public and private participation. Another project completed in 2021 has restored the 18th-century Sabil-kuttab of Ruqayya Dudu in the Suq al-Silah area.<!-- The spelling of the monument's name here follows what is found in more reliable sources like Caroline Williams's book, rather than the awkward and uncommon transliteration in the Al-Ahram article. --> In 2021 the Egyptian government began a new push to renovate the old city, including the areas around the historic city gates, partly with the aim to boost tourism. The effort would also involve restoring buildings that are not officially listed as monuments and pedestrianizing some zones. In some cases the owners or tenants of certain buildings have been relocated elsewhere while restoration is ongoing.