The history of the city of Casablanca in Morocco has been one of many political and cultural changes. At different times it has been governed by Berber, Roman, Arab, Portuguese, Spanish, French, British, and Moroccan regimes. It has had an important position in the region as a port city, making it valuable to a series of conquerors during its early history.
The original Berber name, Anfa (meaning: "hill" in English), was used by the locals until the earthquake of 1755 destroyed the city. When Sultan Mohammed ben Abdallah rebuilt the city's medina, he gave it the name "ad-Dār al-Bayḍāʾ" () a literal translation of Casablanca into Arabic. French forces occupied the city in 1907 and adopted the Spanish name, Casablanca. The name Anfa now refers to an area within Casablanca, slightly West of the 18th century medina.
Roman Anfa
Leo Africanus defined Anfa as a city built by the Romans in his famous Descrittione dell'Africa (Description of Africa), written in the 16th century.
The area which is today Casablanca was founded and settled by the Berbers by about the 10th century BC. It was used as a port by the Phoenicians and later by the Romans.
Romans occupied the area in 15 BC and created the important commercial port know later as Anfa, directly connected to the Mogador island in the Iles Purpuraires of southern Mauritania. From there they obtained a special dye, that colored the purple stripe in Imperial Roman Senatorial togas. The expedition of Juba II to discover the Canary islands and Madeira probably departed from Anfa.
The Roman port, probably called initially Anfus in Latin language, was part of a Berber client state of Rome until Emperor Augustus. When Rome annexed Ptolemy of Mauretania's kingdom, Anfa was incorporated into the Roman Empire by Caligula. But this was done only nominally because the Roman limes was a few dozen kilometers north of the port (the Roman military fortifications of Mauretania Tingitana were just a few kilometers south of the Roman colonia named Sala Colonia). However, Roman Anfa—connected mainly by commerce and by socio-cultural ties to Volubilis ("autonomous" from Rome since 285 AD)—lasted until the 5th century, when Vandals conquered Roman northwestern Africa.
A Roman wreck of the 2nd century, from which were salvaged 169 silver coins, shows that the Romans appreciated this useful port for commerce. There is even evidence of oil commerce with Roman Volubilis and Tingis in the 3rd century. Probably there was a small community of Christians (linked to Roman merchants) in the port city until the fifth/sixth century.
Barghawata
A large Berber tribe, the Barghawata, settled in the area between the rivers Bou Regreg to the north and Oum er-Rbia to the south. It established itself as an independent Berber kingdom in Tamasna around in 744 AD following the Berber Revolt against the Umayyad Caliph Hisham ibn Abd al-Malik. It remained until it was conquered by the Almoravids in 1068 AD.
The Almohad Sultan Abd al-Mu'min drove the Barghawata out of Tamasna in 1149, and replaced them with Bedouin Arab tribes, notably Banu Hilal and Banu Sulaym.
Early modern period
During the 14th century, under the Zenata Merinid Dynasty, the town rose in importance as a port and in the early 15th century, became independent once again. It emerged as a safe harbor for Barbary pirates. In 1468, the city was captured and destroyed by the Kingdom of Portugal and the Algarves under Rei Afonso V the African. The Portuguese used the ruins to build a military fortress in 1515. The village that grew up around it was called "Casa Branca", meaning "White House" in Portuguese.
After the death of Rei Sebastian in the massive Portuguese defeat at the hands of the Moroccan Saadi Empire in the Battle of Alcácer Quibir and the ensuing crisis of succession, Casablanca came under Spanish occupation under the Iberian Union, from 1580 to 1640.
They eventually abandoned the area completely in 1755 AD following an earthquake which destroyed it.
The town and the medina of Casablanca as it is today was founded in 1770 AD by Sultan Muhammad III ben Abdallah (1756–1790), the grandson of Moulay Ismail. Built with the aid of Spaniards, the town was called Casa Blanca (white house in Spanish) translated Dar el Beida in Arabic.