Moroccan Jews constitute an ancient community. Before the founding of the State of Israel in 1948, there were about 265,000 Jews in the country, which gave Morocco the largest Jewish community in the Muslim world, but by 2017 only 2,000 or so remain. Jews in Morocco, originally speakers of Berber languages, Judeo-Moroccan Arabic or Judaeo-Spanish, were the first in the country to adopt the French language in the mid-19th century, and unlike the Muslim population French remains the main (and, in many cases, the exclusive) language of members of the Jewish community there.
History
Origins
It is possible that some Jews fled to North Africa after the destruction of the First Temple in the sixth century BCE or the destruction of the Second Temple in the first century CE. It is also possible that they arrived on Phoenician boats (1500 BCE - 539 BCE).
Based on the writings of Ibn Khaldun, an Arab scholar of the 8th century CE, some suggested that Moroccan Jews were indigenous Imazighen (Berbers) who converted to Judaism, although the question of who converted them remains. This theory has been rejected by most scholars. It was also refuted by modern genetic studies, which revealed that North African Jews are genetically close to European Jews and do not share haplogroups typical of the North African Berber and Arab populations. According to one study, "North African Jews date to biblical-era Israel, and are not largely the descendants of natives who converted to Judaism".
The Jewish community of Ifran, from the Tamazight word ifri meaning cavern, is supposed to date back to 361 BCE and is believed to be the oldest Jewish community in what is now Morocco.
Under the Romans
The first irrefutable evidence of Jews in what is now Morocco, in the form of gravestone epitaphs in Hebrew at Volubilis and the ruins of a third century synagogue, dates back to late antiquity. Emily Gottreich contends that Jewish migration to Morocco predates the full formation of Judaism, as the Talmud was "written and redacted between 200 and 500 CE."
As Christianity was adopted by the Roman state, the church Councils of Carthage adopted policies that discriminated against adherents to Judaism. The Justinian edict of persecution for North Africa, issued after Vandal rule had been overthrown and Mauretania had come under the dominion of the Byzantines (534), was directed against the Jews as well as the Arians, the Donatists, and other dissenters.
In the 7th century, the Jewish population of Mauretania received as a further accession from Iberian Peninsula those who wished to escape Visigothic legislation. At the end of the same century, at the time of the great Arab conquests in northwestern Africa, there were in Mauretania, according to the Arab historians, many Jews.
Arab conquest and the Idrisids (703–1146) Since the city of Fez was founded in 789 CE, it attracted a diverse kind of population from all around the area, among those new newcomers came the Jews who contributed their commercial capabilities to the new developed economy. They settled in the medina of Fez, and formed a stable community, which was an integral part of the city life. The golden age of the Jewish community in Fez lasted for almost three hundred years, from the 9th to 11th centuries. Its yeshivot (religious schools) attracted brilliant scholars, poets and grammarians. This period was marred by a pogrom in 1033, which is described by the Jewish Virtual Library as an isolated event primarily due to political conflict between the Maghrawa and Ifrenid tribes.
Under the Almoravids
The Almoravid dynasty () was an imperial Berber Muslim dynasty originating in the Sahara whose empire eventually extended from Lisbon and Valencia to Awdaghust and Gao. Their religious fervor and fighting capabilities enabled them to establish a formidable empire in the Morocco and Muslim Spain in the 11th and 12th centuries. Their theological Islamic zeal is attributed to Yahya ibn Ibrahim, their spiritual leader, as well as to the 'alim (religious scholar) 'Abd Allah ibn Yasin.