A mellah is a walled Jewish quarter of a city in Morocco, similar to the European ghetto. Jewish population were confined to mellahs since the 15th century. It first was seen as a privilege and protection, but with the growing of the population, it became a poor place. With the colonisation and the arrival of the Europeans at the end of the 19th, the mellah opened and gave new economical and social possibilities to the Moroccan Jews.

In cities, a mellah was surrounded by a wall with a fortified gateway. Usually, the Jewish quarter was situated near the royal palace or the residence of the governor in order to protect its inhabitants. In contrast, rural mellahs were separate villages inhabited solely by the Jews who played a vital role in the local economy.

Historically, the first official mellah was established in the city of Fes in 1438. For a long time, it remained the only one, and only in the second half of the 16th century (around 1557) the term mellah appears in Marrakech, with the settlement there of Jewish population from the Atlas Mountains. A Frenchman, who was held captive in Morocco from 1670 to 1681, wrote: “In Fez and in Morocco, the Jews are separated from the inhabitants, having their own quarters set apart, surrounded by walls of which the gates are guarded by men appointed by the King…In the other towns, they are intermingled with the Moors.” In 1791, a European traveller described the Marrakech mellah: “It has two large gates, which are regularly shut every evening about nine o’clock, after which time no person whatever is permitted to enter or go out…till…the following morning. The Jews have a market of their own…” Only in 1682 the third mellah was founded in the town of Meknes, the new capital of sultan Moulay Ismail.

At the beginning of the 19th century, new Jewish quarters were called mellah everywhere except Tetouan, where the Spanish word Juderia was used. Later on, affluent Jews started to move to the new neighborhoods (villes nouvelles) planned according to European urban schemes, leaving in the mellahs only the elderly and the poorest families.

Since the establishment of the state of Israel in 1948, almost all Moroccan Jews emigrated to the new Jewish state. As a result, nowadays mellahs are only inhabited by Muslims, the few remaining Jews have moved to modern quarters of Moroccan cities.