stylistic:style_transfer, structural:expansion, quality:correction
Ancient settlements

The area around present-day Cairo had long been a focal point of Ancient Egypt due to its strategic location at the junction of the Nile Valley and the Nile Delta regions (roughly Upper Egypt and Lower Egypt), which also placed it at the crossing of major routes between North Africa and the Levant. Memphis, the capital of Egypt during the Old Kingdom and a major city up until the Ptolemaic period, was located a short distance south west of present-day Cairo. Heliopolis, another important city and major religious center, was located in what are now the modern districts of Matariya and Ain Shams in northeastern Cairo. It was largely destroyed by the Persian invasions in 525 BC and 343 BC and partly abandoned by the late first century BC.

However, the origins of modern Cairo are generally traced back to a series of settlements in the first millennium AD. Around the turn of the fourth century, as Memphis was continuing to decline in importance, the Romans established a large fortress along the east bank of the Nile. The fortress, called Babylon, was built by the Roman emperor Diocletian (r. 285–305) at the entrance of a canal connecting the Nile to the Red Sea that was created earlier by emperor Trajan (r. 98–117). Further north of the fortress, near the present-day district of al-Azbakiya, was a port and fortified outpost known as Tendunyas (Coptic: ϯⲁⲛⲧⲱⲛⲓⲁⲥ) or Umm Dunayn. While no structures older than the 7th century have been preserved in the area aside from the Roman fortifications, historical evidence suggests that a sizeable city existed. The city was important enough that its bishop, Cyrus, participated in the Second Council of Ephesus in 449.

The Byzantine-Sassanian War between 602 and 628 caused great hardship and likely caused much of the urban population to leave for the countryside, leaving the settlement partly deserted. The site today remains at the nucleus of the Coptic Orthodox community, which separated from the Roman and Byzantine churches in the late 4th century. Cairo's oldest extant churches, such as the Church of Saint Barbara and the Church of Saints Sergius and Bacchus (from the late 7th or early 8th century), are located inside the fortress walls in what is now known as Old Cairo or Coptic Cairo.