The area which is today Casablanca was settled by Berbers by about the 10th century BC. It was used as a port by the Phoenicians and later the Romans.
In his book “Wasf Afriquia” Hassan Al Wazan refers to "Anfa" (ancient Casablanca) as a great city which was founded by the Romans. He also believed that Anfa was the most prosperous city on the Atlantic coast because of its fertile land.
A small independent kingdom, in the area then named Anfa, arose around late Roman time in response to Arab Muslim rule, and continued until it was conquered by the Almoravids in 1068.
During 14th century, under the Merinids, the town rose in importance as a port and in the early 15th century, became independent once again. It emerged as a safe harbour for pirates. This led to attacks by the Portuguese, who destroyed the town in 1468. The Portuguese used the ruins to build a military fortress in 1515. The village that grew up around it was called "Casabranca", meaning "White House" in Portuguese. They eventually abandoned the area completely in 1755 following an earthquake which destroyed it.
The town and the medina of Casablanca as it is today was founded in 1770 by sultan Mohammed 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 Beidain Arabic.
In the 19th century Casablanca became a major supplier of wool to the booming textile industry in Britain and shipping traffic increased (the British, in return, began importing Morocco's now famous national drink, gunpowder tea). By the 1860s, there were around 5,000 residents, and the population grew to around 10,000 by the late 1880s.[4] Casablanca remained a modestly sized port, with a population reaching around 12,000 within a few years of the French conquest and arrival of French colonialists in the town, at first administrators within a sovereign sultanate, in 1906. By 1921, this was to rise to 110,000, largely through the development of bidonvilles