The story of Tunis did not begin with the moment it became a capital. The city existed centuries before, but at first it was not the one that would later assume its role.

Unlike Kairouan, which was founded in 50 AH/670 CE as a base for the Islamic presence in Africa, Tunis was an established city on the coast. Its importance then grew gradually until, in later eras, it became a politically, scholarly and commercially influential centre.

The greatest shift came when the scholarly, political and commercial wealth of Kairouan gradually moved to Tunis, which became one of the most important cities of the Islamic Maghreb.

The UNESCO describes the old city as one of the oldest Arab-Islamic cities in the Maghreb, and considers that under the Almohads and the Hafsids Tunis reached a status that made it one of the greatest and richest cities of the Islamic world. The city still contains some 700 historical monuments, including mosques, madrasas, palaces and markets.

Ribat of Monastir, one of the most important landmarks of the Tunisian city of Monastir, known as one of the most important and oldest Islamic defensive fortresses in the Maghreb region.

From an African City to an Islamic City

The development of Tunis was linked to the major transformations that Africa witnessed after the Islamic conquest.

Sources indicate that the city saw an important development at the end of the first century AH, when the Zaytuna Mosque became an urban and religious centre around which the Islamic city began to take shape.

Accounts attribute the founding of the mosque to Hassan ibn al-Nu'man in 79 AH/698 CE, and its construction was completed under Ubayd Allah ibn al-Habhab in 116 AH/734 CE, before it was rebuilt on a large scale in the Aghlabid era in 248 AH/863 CE. Specialised sources affirm that the history of the mosque is composed of multiple stages, which is why accounts differ on identifying its first founder.

Here the distinctiveness of Tunis appears: the city was not built around a ruler's palace; its Islamic heart crystallised around the mosque and the market.

As the city grew, a network of markets, crafts and neighbourhoods took shape, and the area surrounding the Zaytuna became the centre of religious and commercial life.

Zitouna Mosque: the heart of the old city and its religious and scholarly center. It was linked to the formation of Islamic life in Tunisia and its later emergence as a center of learning in the Islamic Maghreb.

When the Capital Moved from Kairouan

Kairouan remained the political and cultural centre of Africa for centuries, but political and military changes in the region gradually shifted the centre of gravity towards Tunis.

In the Almohad era Tunis became an important capital for Africa, and then the Hafsids came in the seventh century AH/thirteenth century CE, and the city was transformed into the capital of an independent state with wide influence.

Here Tunis began a markedly different phase.

Historical sources affirm that under the Almohads and the Hafsids, from the sixth to the tenth century AH/twelfth to sixteenth century CE, Tunis was among the largest and richest cities of the Arab and Islamic world.

The Hafsids: The Era in Which Greater Tunis Was Born

The rise of the Hafsid state was the fundamental turning point in the city's history.

Tunis became the seat of government, expanded urbanistically, and madrasas, mosques, markets and sultanic structures were built in it, while its ties to the Andalusian, Maghrebi and Mediterranean worlds grew stronger.

Among the most prominent witnesses of that phase is the Kasbah Mosque, built by Abu Zakariya al-Hafsi in the seventh century AH/thirteenth century CE, which became part of the city's political and religious system. The network of madrasas, zawiyas and scholarly institutions that made Tunis a centre of learning also developed.

Urban development was not separate from authority; the mosque, the madrasa, the palace, the market and the gate all became parts of a single system reflecting the rise of the Hafsid capital.

Kasbah Mosque

The Zaytuna: When the Mosque Became a School for the Islamic World

But what gave Tunis its standing was not its palaces… it was knowledge.

The Zaytuna Mosque was not merely a place of prayer; over the centuries it became a centre for teaching jurisprudence, hadith, language and the sciences of the Qur'an.

As Tunis rose politically, the Zaytuna became the scholarly heart of the capital, attracting scholars and students from Ifriqiya, the Maghreb, al-Andalus and the East.

The Tunisian Ministry of Cultural Affairs notes that the mosque remained one of the most prominent religious and scholarly landmarks in Tunisia and the Islamic world, and that it witnessed expansions and additions during the Fatimid, Zirid and Hafsid eras, and a library was established in it during the Hafsid era.

From this scholarly environment emerged names that left an influence extending beyond Tunis itself.

Therefore, speaking of Tunis is incomplete if it only addresses its markets and palaces; it is also a city that produced and circulated knowledge.

Tunis and al-Andalus: A City That Received Those Whose Cities Had Fallen

The relationship between Tunis and al-Andalus was among the most influential in shaping the city.

This influx contributed to revitalising intellectual, cultural and economic life, and to shaping part of the architecture, arts and urban customs.

Thus Tunis became one of the cities in which the experience of al-Andalus met the traditions of Ifriqiya, the Maghreb and the East.

Historical sources describe the city's location as a link between the Maghreb, southern Europe and the East, which helped exchanges of influence in the arts and architecture over many centuries.

The City of Markets: The Economy That Built the Capital

Tunis was not only a capital of learning and politics. Its proximity to the sea made it part of the Mediterranean trade network, while overland routes connected it to the interior of the Maghreb.

Specialised markets developed in the city, such as the perfumers' market and markets for crafts and trades, and the markets became part of the urban fabric itself.

Notably, the Islamic city did not divide life into entirely separate zones; the mosque, the market, the madrasa, the bathhouse, the caravanserai, the house and the gate all formed an interconnected urban system.

For this reason, UNESCO considers the old city of Tunis a largely preserved model of the Islamic city in North Africa, with its walls, gates, markets, residential quarters and religious institutions.

Tunis: When the City Became the Heart of a State

By the eighth century AH/fourteenth century CE, Tunis had long surpassed its role as a regional city.

It was the capital of a Hafsid state, a commercial centre connected to the Maghreb, al-Andalus, Europe and the East, and a scholarly centre attracting scholars.

At this stage Ibn Khaldun emerged in the Tunisian environment, then left it for a long journey between the Maghreb, al-Andalus and the East, before later writing the "Muqaddimah," which became one of the most famous intellectual texts in the Islamic heritage.

Thus Tunis became one of the cities that not only received Islamic civilisation but also took part in producing it.

From Capital of the Hafsids to the Memory of the Islamic Maghreb

States changed afterwards, the forces ruling Tunis shifted, and the city passed through Ottoman and then Husainid phases, but its Islamic fabric remained present.

The mosques, madrasas, zawiyas, markets and palaces did not disappear; new layers were added to them.

UNESCO inscribed the old city on the World Heritage List in 1979 CE/about 1400 AH, in recognition of its architectural, urban and historical value.

Tunis: The City That Inherited Kairouan Without Erasing It

The most important point in Tunis's story is that it did not appear suddenly on the ruins of Kairouan; rather, a gradual transfer of functions took place.

Kairouan consolidated Islam in Ifriqiya, then Tunis became a new political, commercial and scholarly capital.

In this way the two cities represent complementary stages in the history of the Islamic Maghreb: Kairouan was the city of foundation, conquest and Maliki scholarship, while Tunis became the city of the state, the capital, commerce and Mediterranean expansion.

Hence the importance of Tunis on the map of Islamic metropolises: it is the city that shifted the centre of gravity from the African interior to a city more connected to the Mediterranean, and then became a bridge between the Maghreb, the East, al-Andalus and Europe.