quality:correction, stylistic:style_transfer
Under Islamic rule (640–1800)

In 969, Egypt entered the Fatimid dynasty (in Egypt from 969 to 1171), who adopted a largely favorable attitude toward the Christians. The major exception to this was the persecution led by Caliph al-Hakim between 1004 and 1013, which included clothing regulations, prohibition of publicly celebrating Christian festivals, and dismissal of Christian and Jewish functionaries. However, at the end of his reign al-Hakim rescinded these measures, allowing the Copts to regain privileged positions within the administration.

The Coptic patriarchal residence moved from Alexandria to Cairo during the patriarchate of Cyril II (1078–92). This move was at the demand of the grand vizier Badr al-Jamali, who insisted that the pope establish himself in the capital. When Saladin entered Egypt in 1163, this ushered in a government focused on defending Sunni Islam. Christians were again discriminated against, and meant to show modesty in their religious ceremonies and buildings.

During the Ottoman period, Copts were classified alongside other Oriental Orthodox and Nestorian peoples under the Armenian millet.

In 1798, the French invaded Egypt unsuccessfully and the British helped the Turks to regain power over Egypt under the Muhammad Ali dynasty.