Ceuta lay in ruins until it was resettled in the 9th century by Mâjakas, chief of the Majkasa Berber tribe, who started the short-lived Banu Isam dynasty.
Apart from Ibn Hud's rebellion of 1232, they ruled until the Tunisian Hafsids established control.
The Hafsids' influence in the west rapidly waned, and Ceuta's inhabitants eventually expelled them in 1249.
Its population consists of Christians, Muslims and small minorities of Sephardic Jews and ethnic Sindhi Hindus.
Spanish is the official language, while Darija Arabic is also spoken by 40–50% of the population, which is of Moroccan origin.
The Benemerine sultan started the Siege of Ceuta (1418) but was defeated by the first governor of Ceuta before reinforcements arrived in the form of John, Constable of Portugal and his brother Henry the Navigator who were sent with troops to defend Ceuta.