The city's name as it is locally pronounced is "Asfi", which was Latinized as "Safi" and "Safim" under Portuguese rule. "Asfi" means flood or river estuary in Berber and comes from the Berber root "sfi/sfey" which means to flood, to spill or to pour.
11th-century geographer Al-Idrisi gave an apparently false explanation to the origin the name "Asfi" as he linked it to the Arabic word "Asaf" (regret); Asafi (my regret). He based this claim on a strange story about some sailors from al-Andalus who sailed to discover the other end of the Atlantic Ocean but got lost and landed on some island where the natives captured them and sent them back on their ships blindfolded. The ships eventually ended on the shores of "Asfi" and locals helped the lost sailors and told them that they were two months away from their native land al-Andalus. Upon hearing this one of the sailors responded by saying: "Wa asafi" (Oh my regret). Al-Idrisi wrote that from that time the city carried the name "Asafi". This story is thought to be a legend and unlikely explanation of the origin of the name.
Safi has a Mediterranean climate.
Safi, under the name Safim (Zaffim or Asfi), is one of the oldest cities in Morocco, hence its foundation date is unknown. According to historian Mohammed al-Kanuni, Safi must be identified with the ancient Thymiaterion or Carcunticus and was founded by the Carthaginian Hanno during his Periplus as related by Pliny the Elder.
Under the Almohads it functioned as an important port to the capital Marrakesh.
The city was under Portuguese rule from 1488 to 1541; it is believed that they abandoned it to the Saadians (who were at war with them), since the city proved difficult to defend from land attacks. The Portuguese fortress built to protect the city is still there today.
After 1541, the city played a major role in Morocco as one of the safest and biggest seaports in the country. Many ambassadors to the Saadian and Alaouite kings during the 16th–18th centuries came to Morocco via Asfi; its proximity to Marrakech, then capital of Morocco, helped expand the maritime trade in the city. Louis De Chénier, consul of the French court in Morocco in 1767, reported that the city was the only usable seaport at the time.
A French Navy captive, Bidé de Maurville, who wrote the account of his stay in Morocco in his 1765 book Relations de l'affaire de Larache, reported the presence of an important number of foreign trading houses in the city : Dutch, Danish, British and French.
After the Sultan Mohammed ben Abdallah built the city of Mogador, he banned foreign trade in all Moroccan ports except in his newly built city. Consequently, Safi stopped playing a leading role in the Moroccan trade.
Safi's patron saint is Abu Mohammed Salih.
In 1942 as part of Operation Torch, American forces attacked Safi and took relatively quickly and with relatively few casualties compared to the other operations at Casablanca and at Port Mehdia.
The inhabitants are composed of Berbers and Arabs descended from the following:
Two Arab tribes namely:
Also note that Safi had a large Jewish community that emigrated to France today, Canada or Israel, which at the time represented more than 20% of the population.
Football and rugby are popular sports in Safi. The local football team Olympic Safi have been competing in Morocco's premier football division, Botola, since 2004. The Rugby Union team of the same name is one of Morocco's best, having won the "Coupe du Trône" several times.