In the mid-7th century, Christianity was severely challenged in North Africa, including present-day Tunisia. Following the death of the Prophet Muhammad, the Umayyad caliphate, which reigned between 661 and 750 from Damascus, controlled the newly created Islamic state. Under the command of Uqba ibn Nafi, an Arab Muslim army in 670 entered the Roman province of Africa, called Ifriqiya in Arabic.
On behalf of the Damascus-based Umayyad dynasty, Uqba ibn Nafi founded the city of Kairouan (‘stronghold’ in Arabic), which would become their base in their struggle for conquest. Kairouan’s location, between the coast and the mountains, revealed that Uqba ibn Nafi intended to extend his influence to Tunisia’s southern autonomous Berber regions, which had largely escaped Carthaginian and Roman control.
The main resistance to the Arab Muslim army consisted initially of Berber forces, often Christians led by Kusaila. Eventually, however, these Berbers were defeated and Kusaila imprisoned. The Islamic conquest of North Africa was almost completed when Caliph Abd al-Malik took power – he ruled from 685 to 705 – leading to the conquest of strategically important Carthage.
Despite the gradual advance of Arab Muslim troops into Berber territories, some Berbers continued to offer fierce resistance. The Jarawa tribe, for example, led by a woman called by the Arabs ‘the prophetess’ (Dihya, or Kahena) attacked the Islamic troops continuously, although, for strategic reasons, without threatening their base in Kairouan. In 696, she defeated the Arabs at Tébessa, which is now part of Algeria, but she was eventually killed in al-Jem. Upon her death, she became a legend and a national hero who is still celebrated in Tunisia.
After the fall of the Umayyad caliphate in Damascus in 750, Berber disorder increased in North Africa. The quick establishment of the Abbasid caliphate in Baghdad in 750 helped little to contain the unrest. The geographical distance to the capital of the caliphate also bothered some of the Arabs in Ifriqiya, who were disturbed by the caliphate’s meddling in what they considered regional affairs. During the increasing unrest, a provincial leader, Ibrahim I ibn al-Aghlab, led an army with which he managed to enforce stability in Ifriqiya.
When he had re-established stability, Ibn al-Aghlab was awarded the title of amir, and he and his descendants ruled Ifriqiya from 800 to 909. Under Aghlabid rule, the economy of Ifriqiya improved markedly. The water system was improved, to supply towns and promote the growing of olive trees and other agricultural products. Trade routes were established that connected Ifriqiya with the interior of the continent, including Sudan and the Sahara. Sea routes linked Ifriqiya to Alexandria in Egypt, which would soon become a main destination for merchants.
Despite the relative prosperity of the population at that time, the rule was not popular amongst Arabs or Berbers. The unpopularity can be attributed to several mutually reinforcing factors: the perceived lack of legitimacy of the administration which ruled from such a great distance, in Baghdad; the un-Islamic way of life of many of its rulers; and the disrespect they showed Berbers who converted to Islam. Such practices were contrary to the dominant Maliki school of Islam in Tunisia.
The Rustamid Kingdom
The Rustamid kingdom had its roots in the Kharijite rebellion against the fourth caliph Ali, which caused a division in his armed forces. The Kharijites (‘those who go out’, alluding to the split within the military) followed a puritanical and egalitarian belief that appealed to many Berbers. In North Africa, the Berber Kharijites soon rebelled against the rulers on account of its discrimination against Muslim Berbers, in the form, for instance, of a special tax imposed on them. Decades of armed clashes between the Kharijites and the Arab Islamic regime followed, resulting, in 772, in a defeat of the Berber Kharijites.
Some Kharijtes, however, remained in the region, and in 776 they established an administration, with its capital at Tahert, on the southern slope of the Ouarsenis mountains, in present-day Algeria. Their rulership lasted until 909 and became part of the Rustamid kingdom, founded by Abd al-Rahman ibn Rustam, an imam of Persian origins. It was governed as a theocracy by religious leaders descended from Ibn Rustam.
The Aghlabids in Ifriqiya were unable to defeat the neighbouring Rustamid kingdom and were forced to recognize its authority over the Sahara area in North Africa. Tahert, the capital, derived its wealth from its control of trade across the Sahara: gold, ivory, and slaves were passed along the route, in exchange for goods produced in the Mediterranean basin. The kingdom attracted people from across the Islamic world, including Christians, who were well received by Kharijites. In 909, both the Rustamid kingdom and the Aghlabid province of Ifriqiya were conquered by the Fatimids. Some remaining Kharijites can, however, still be found in eastern Algeria, western Libya, and Tunisia’s Djerba Peninsula.
The Fatimid Dynasty
Founded by Abu Muhammad Ubayd Allah al-Mahdi bi-Allah al-Shii from al-Yemen and Ubayd Allah from Syria, the Fatimid dynasty emerged in the Maghreb, with the support of the Kutama Berbers from what is now eastern Algeria. The Fatimid dynasty was a branch of the Shiism, Abu Muhammad Ubayd Allah al-Mahdi bi-Allah being a descendant of Fatima,
the Prophet Muhammad’s daughter, hence the name of the movement. The Kutama Berbers welcomed the founders’ rejection of the caliphate in Baghdad and joined their cause.
Eager to expand their territory, the Fatimid movement attacked the Aghlabid rulership repeatedly, increasing the instability in Ifriqiya. In 909 the Fatimids conquered the city of Kairouan and forced the evacuation of the palace at Raqadda, and almost simultaneously captured the Rustamid Kingdom.
The Fatimids’ capital, Mahdia, was built on Ifriqiya’s east coast and was named after the Mahdi (‘the rightly guided one’, a religious title) and bi-Allah (rightly guided by God), as Abu Muhammad Ubayd Allah al-Mahdi bi-Allah was called. The Fatimids derived legitimacy from two sources: their direct links to the Prophet Muhammad and the title of caliph bestowed on the first ruler.
Many Sunnis nevertheless fiercely opposed the expansion of the Fatimids into Ifriqiya, including Kairouan, as the Fatimids’ Shiite traditions were strongly at odds with the then dominant teachings of the Maliki school. The harsh taxation scheme of the Fatimids was particularly unpopular amongst the Sunni population.
Ubayd Allah al-Mahdi’s death was the occasion of a large-scale Kharijite attack against the Fatimids, who were now ruled by the son of Ubayd Allah al-Mahdi. This led, in the mid-10th century, to the latter’s defeat in Mahdia, but the Fatimids eventually reasserted themselves in battle and successfully besieged the Kharijites.
Only under the reign of the fourth Fatimid caliph, al-Muizz, with his successful war policies and effective diplomacy, were the Fatimids able to establish a firm rule over North Africa and expand their territory. The Fatimid empire would, however, shift eastward in 968, with the conquest of Egypt, where the Fatimids founded their capital, Cairo (al-Qahira, in Arabic). There they also established al-Azhar Mosque, which would become the main centre of Sunni Islam.
In 973, the Fatimid caliph al-Muizz moved from Ifriqiya to Egypt, where he reigned until 1171. The Fatimids, for some time the predominant Islamic power, would never return to Ifriqiya. The Kutama Berbers, exhausted by their conflict with the Fatimids, would gradually disintegrate as a distinct identity. Ifriqiya eventually came under the rule of Berber vassals. The first ruler was Buluggin ibn Ziri, founder of the Zirid dynasty.
While the Berber vassals initially governed under the aegis of the Fatimid Shiite caliphate, they gained their independence in 1048. Towards the end of the 11th century, Ifriqiya was invaded by the Banu Hilal tribes, who weakened the Zirid dynasty significantly. Adding to the instability, Sicilian Normans captured the city of Mahdia in 1148.
The Almohads
The Almohads ruled in North Africa from 1130. Founded in Morocco by the Masmuda Berber Ibn Tumart, the Almohads followed a puritanical version of Islamic law that preached the unity of God. It rejected the Maliki Sunni school of Islam and all other Islamic schools. On Ibn Tumart’s death, Abd al-Mumin succeeded him as the first Almohad caliph, with the mission of creating a unified
Islamic community in North Africa, to which end he invaded the eastern Maghreb. In the mid-12th century, he reached the Zirid empire, which was then seriously destabilized by the Norman invasion of Mahdia a few years earlier.
Benefiting from Ifriqiya’s instability, Abd al-Mumin occupied Tunis and defeated the Normans. Most of the Normans left Ifriqiya, although some stayed on as merchants. Abd al-Mumin continued his quest for territory and eventually captured Tripoli. For the first time, the Maghreb was united under an authority of local origin.
The strength of the Almohads, their wealth, and the excellent reputation of their army led England’s King John to investigate this influential Maghreb power in order to determine whether the Almohads had designs on the English territory of Aquitaine, north of the Pyrenees.
In the end, however, the Almohads did not have the necessary human and material resources to administer and defend their far-flung empire. Only two decades later, the Banu Ghaniya, who saw themselves as the heirs of the Almoravids, began a revolt in the Balearic Islands. The rebellion reached Ifriqiya in 1184 and destabilized the region for the next five decades.
The Hafsid Dynasty
The Almohad empire was succeeded in 1230 by the Hafsid dynasty, which lasted until 1574. The Hafsids rejected the authority of the Almohads, claiming that it was they themselves who embodied the legacy of Ibn Tumart, the founder of the Almohads. During his lifetime, Ibn Tumart founded the Group of Ten, consisting of the closest adherents of the Almohads.
One influential member of this group was Umar Abu Hafs al-Hintati, whose son Umar al-Hintati was the governor of Ifriqiya province from 1207 until his death in 1221. The son of Umar al-Hintati, Abu Zakariya, became governor of Gabes and later of Tunis.
Following disagreements with the Almohads, Abu Zakariya declared the independence of the Hafsids, granting himself the title of amir. During the subsequent years, Abu Zakariya took the cities of Ifriqiya, as well as Algiers in the west and Tripolitania in the east. The Hafsids concentrated their rule on coastal regions, leaving the inland regions to the Berbers.
Soon the Hafsids’ supremacy in the region was officially recognized by neighbouring territories, such as Morocco and al-Andalus. In 1259, Abu Zakariya’s son, al-Mustansir, officially became the caliph of the Islamic world, after the fall of Bagdad in 1258. Although only three years later he had to pass on the title to a rival, the Hafsids remained a significant regional power. Under the Hafsid dynasty, the Maliki school became once more the central school of law in the region, but it was being changed and partially liberalized from within.
Local custom was accepted as part of the legal framework. In Kairouan, for example, marriage contracts were redesigned to accommodate women’s rights, prohibiting husbands from taking more than one wife. The Islamic concept of maslaha (public interest) opened up Islamic law to interpretations that took account of the community’s particular circumstances and needs, a development that has shaped Tunisia up to the present.
The Hafsid dynasty guaranteed relative prosperity through the increase in regional trade, especially between the Sahara and the Sudan and with the Mediterranean countries, including the Europeans, with whom the Hafsids exchanged ambassadors. Practices and laws were developed throughout the region to regulate trade. Shipping practices were improved to ensure efficient sea trade, and Tunis, Mahdia, Gabes, and Djerba became the most important ports in what is now Tunisia. Islamic law was enriched and extended in order to guarantee moral issues and regulated trading through, for example, enhanced security in the market place, the principles of fair dealing, and the supervision of important business practices.
Nevertheless, beginning in the mid-14th century, the region faced significant economic difficulties, which stemmed from factors such as increasing problems in its Sahara trade. The Hafsids’ influence was also threatened by regional power struggles. In 1270, during the eighth crusade, Hafsid relations with Europe worsened when King Louis IX of France attempted to take Tunis. In the mid-13th century, the rising power of Morocco, at that time ruled by the Marinids of Fez, threatened the Hafsid dynasty; Morocco twice captured Tunis briefly.
In the end, though, it was internal conflict amongst the Hafsids – and a war between the Turks and Spaniards – that led to the dynasty’s decline. The Hafsid rulers became so weak that they were little more than helpless spectators in the face of foreign intervention: the Turkish conquest of Tunis in 1574 brought the Hafsid dynasty to an end.