According to tradition, the original location was chosen by a bird. Amr ibn al-As, by order of Caliph
Umar, was the Arab general that conquered Egypt from the Romans. In 641 CE, before he and his army attacked their capital city of Alexandria (at the northwestern part of the
Nile Delta), the commander had set up his tent on the eastern side of the Nile, at the southern part of the delta. As the story is told, shortly before he set off to battle, a dove laid an egg in the commander's tent. When he returned victorious, he needed to choose a site for a new capital city, since Umar had decreed that it could not be in far-away Alexandria. Therefore, the commander was inspired to declare the site of the dove's egg as the centre of a new capital city,
Fustat, or
Misr al-Fustat, "City of the Tents". The commander built a grand mosque at the site of his tent in the encampment.
Renovations and expansions '' in 1870. The arcaded colonnade still exists, while the central structure has undergone some changes over time. The complex was completely rebuilt in 673 CE by the governor
Maslama ibn Mukhallad al-Ansari, who added four
minarets, one at each of the mosque's corners, and doubled its area in size. The addition of these minarets allowed the call to prayer to be heard from every corner, and taken up by other nearby mosques. Governor
Abd al-Aziz ibn Marwan added an extension to the mosque in 698 CE and once again doubled the mosque's area. In 711 a concave
prayer niche was added to replace the flat one. In 827 CE, it had seven new aisles built, parallel to the wall of the
qibla, the direction Muslims face during prayer. Each aisle had an arcade of columns, with the last column in each row attached to the wall by means of a wooden
architrave carved with a frieze. In 827 CE, governor
Abd Allah ibn Tahir made more additions to the mosque. It was enlarged to its present size, and the southern wall of the present day mosque was built. In the 9th century, the mosque was extended by the
Abbasid Caliph
al-Mamun, who added a new area on the southwest side, increasing the mosque's dimensions to . In 1169, the city of Fustat and the mosque were destroyed by a fire that was ordered by Egypt's own vizier
Shawar, who had ordered its destruction to prevent the city from being captured by the
Crusaders. After the Crusaders were expelled, and the area had been conquered by
Nur al-Din's army,
Saladin took power, and had the mosque rebuilt in 1179. During this time Saladin had a
belvedere built below a minaret. In the 14th century CE, Burhan al-Din Ibrahim al-Mahalli paid the costs of restoring the mosque. In 1303, Emir
Salar restored the mosque after
an earthquake. He also added a stucco prayer niche for the outer wall of the mosque, which is now gone. In the 18th century CE,
Mourad Bey, one of the Egyptian Mamluk leaders, destroyed the mosque because of dilapidation. In 1796, he then ordered the mosque to be rebuilt, before the arrival of
Napoleon's
French Expedition to Egypt. During Mourad's reconstruction, the builders decreased the number of rows of columns from seven to six, and changed the orientation of the aisles to make them perpendicular to the
qibla wall. It was also probably at this time that the current remaining minarets were added. During the
French occupation much of the interior wood decoration was taken for firewood by the French Army. In 1875, the mosque was rebuilt again; and in the 20th century, during the reign of
Abbas Helmi II, the mosque was again restored. Parts of the entrance were reconstructed in the 1980s. == Architecture ==