Cairo is not a Pharaonic city, though the presence of the Pyramids leads many to believe otherwise. At the time the Pyramids were built, Egypt's capital was Memphis, 22km (13.5mi) south of the Giza plateau.
The core foundations of the city of Cairo (then called Al-Qahira) were laid in 969 by the Fatimids, an early Islamic dynasty from North Africa. There had been earlier settlements, notably the Roman fortress of Babylon, and Fustat, which was established by the Arab army that conquered Egypt for Islam in 642. But the Fatimids established the core of Cairo as it is today; their mosque and university of Al-Azhar is still Egypt's main centre of Islamic study, while the three great gates of Bab an-Nasr, Bab al-Futuh and Bab Zuweila continue to straddle two of Old Cairo's main thoroughfares.
Under the rule of subsequent dynasties Cairo swelled and burst its walls, but at heart it remained a medieval city for 900 years. It wasn't until the reign of Ismail, grandson of Mohammed Ali, in the mid-19th century that Cairo started to change in any significant way. Before the 1860s Cairo extended west only as far as what is today Midan Opera. The future site of modern central Cairo was then a swampy plain subject to the annual flooding of the Nile.
In 1863, when the French-educated Ismail came to power, he was determined to upgrade the image of his capital, which he believed could only be done by dismissing what had gone before and starting afresh. For 10 years the former marsh became one vast building site as Ismail invited architects from Belgium, France and Italy to design and build a new European-style Cairo beside the old Islamic city. During his reign the Suez Canal was finished and opened with much fanfare, and the city attracted the attention of the whole world. In the heady times that followed, tourism and business boomed, and Cairo almost had the character of a gold-rush town. European bankers, with the connivance of their governments, bestowed lavish loans at insatiable rates of interest upon Ismail for his grandiose schemes. In 1882 it all came to an end when the British stepped in and announced that until Egypt could repay its debts, they were taking control.