The medina of Tunis, the oldest section of the city, dates from this period, during which the region was conquered by Arab troops led by the Ghassanid general Hasan ibn al-Nu'man.
The city had the natural advantage of coastal access, via the Mediterranean, to the major ports of southern Europe.
In the 2nd millennium BC a town, originally named Tunes, was founded by Berbers and also over time occupied by Numidians.
Situated on a hill, Tunis served as an excellent point from which the comings and goings of naval and caravan traffic to and from Carthage could be observed.
While there are a few ancient translations of Punic texts into Greek and Latin, as well as inscriptions on monuments and buildings discovered in North Africa, the main sources are Greek and Roman historians, including Livy, Polybius, Appian, Cornelius Nepos, Silius Italicus, Plutarch, Dio Cassius, and Herodotus.
Situated on a large Mediterranean Sea gulf (the Gulf of Tunis), behind the Lake of Tunis and the port of La Goulette (Ḥalq il-Wād), the city extends along the coastal plain and the hills that surround it.
Different explanations exist for the origin of the name Tunis.
Some scholars relate it to the Phoenician goddess Tanith ('Tanit or Tanut), as many ancient cities were named after patron deities.
Local opposition to the authorities began to intensify in September 945, when Kharijite insurgents occupied Tunis, resulting in general pillaging.
In 1048 the Zirid ruler Al-Muizz ibn Badis rejected his city's obedience to the Fatimids and re-established Sunni rites throughout all of Ifriqiya.