||Responsa by the Chief Rabbi of Gibraltar, R. Joseph Elmaleh (1750–1823), kabbalist and halakhist, was considered one of the outstanding Moroccan scholars of his time. He served as rabbi of Sale and of Rabat in 1780. There he maintained a large yeshivah, which continued to function after his death. In 1809 he was in Gibraltar with the intention, according to one source, of journeying on to Erez Israel, and was invited to serve as rabbi there. In the same year, however, he returned to Rabat. He introduced a special tax (imposta) on behalf of the poor, which is still levied. His responsa (Leghorn, 1823–1855), chiefly on Hoshen Mishpat and in part on Even Ha-Ezer, are a valuable source for the history of the Jews of Morocco.
Jews have lived in Gibraltar since the 14th century, in 1356 a community appeal for assistance in the ransoming of Jews captured by pirates is recorded. The Treaty of Utrecht (1713), that ceded the fortress to England, excluded the Jews from Gibraltar in perpetuity. However, by an agreement in 1729 between England and the sultan of Morocco, his Jewish subjects were empowered to come there temporarily for purpose of trade, and the establishment of a permanent community followed soon thereafter. The majority of the Jewish settlers were from adjacent parts of North Africa. By 1749, when the legal right of Jewish settlement was recognized, the community numbered about 600, being about one-third of the total number of civilian residents, and there were two synagogues. In the middle of the 19th century, when the Rock was at the height of its importance as a British naval and military base, the Jewish community numbered about 2,000 and most of the retail trade was in their hands, but thereafter the number declined. The community still maintains four synagogues and many communal organizations.