The early centuries
In 709, the troops of Musa bin Nusayr arrived and after a futile resistance of Tangier, Ceuta is surrendered with an agreement that would allow residents to maintain their customs and beliefs, and so one of the first documented Mozarabic communities was born.
In the middle of the same century, Medina Sebta served as a refuge for Syrian cavalry and when they had left the Berbers razed it in 742. It was rebuilt by the nearby tribes, then in 931 was conquered by Abd-ar-Rahman III for the Caliphate of Cordoba.
During this period, the city built new walls and doors, some of which have been found recently, parallel to the Foso Real (Real Moat.) The prosperity that is attached to the Caliphate will turn the city into the preferred destination of Christian merchants of Marseilles, Genoa, Pisan... who soon settled on its outskirts.
Revolutions and invasions
The fall of the Caliphate of Cordoba at the hands of Hammudi lead frequent independent rebellions that turn Ceuta into an independent Manorialism in 1061, commanded by al-Bargawati Suqut. It is a short period, ending in 1084 with the Almoravid invasion of Tasufin Ibn Yusuf, whose son and successor Yusuf ibn Ali ibn Tasufin would be born in Ceuta.
In the twelfth century, tranquillity is restored by the Almohads who will not always dominate the city. For example, in 1147 a revolt would put the Medina Sebta under the power of a Ceuta scholar of great importance in medieval times: the Qadi Ayyad.
In the following century, some decline in trade relations with the strongest European countries is perceived. This trade is undermined by the movements in pursuit of a greater religious compliance which will lead into martyrdom as Saint Daniel and his seven Franciscan companions meet death in the city on October 10, 1227.
The end of Islamic rule
A mid-thirteenth century Ceuta falls into the reign of the kingdom of Murcia, although still paying tax to the Almohads, and then to the Hafsids of Tunisia, until a Marinid-Aragonese fleet would conquer it in 1273 for Benimerines. Still, there was another period of peninsular dependence at the hands of Nasrids of Granada between 1305 and 1309, succeeding the Marinid-Aragonese fleet that year.
Marinids and Granada continued to fight in the Strait in the following decades. Ceuta is debated between them until a new Granada domination, between 1384 and 1387, under the power of Marinids who take the city again, and who will be those who will face the might of the fleet of John I of Portugal.
The Portuguese conquest puts an end to the medieval period when few moments of peace and stable government were enjoyed by the inhabitants of Medina Sebta, at times dominated by the North, at times by the South, and not fully independent.