Since the late 17th century the Algerians were able to gain possession and recognition of sovereignty over a portion of eastern Morocco around Oujda, initially after a set of victories against the Moroccan Sultan Ismail Ibn Sharif in engagements such as the Battle of Moulouya and the Siege of Oran, in which the Deylik of Algiers and Spain cooperated against Morocco. Upon the proclamation of the Moroccan Sultan Moulay Slimane, the Bey of OranMohammed el-Kebier, after succeeding in liberating Oran from Spanish occupation, crossed into Moroccan territory under the pretext of preparing the siege of Melilla. Later developments proved, however, that the siege of this fortress was but a cover for the territorial ambitions of the Bey.
Capture
In 1792 the Algerians managed to conquer and take control of the eastern Rif region in Morocco. The Bey of Oran then withdrew to Algeria as soon as he had appointed his qaids for the eastern provinces.
Aftermath
Between 1795 and 1798 the Algerians abandoned the eastern Rif region along with the eastern part of Morocco that they had reigned over just before the arrival of a military expedition that was sent by the 'Alawi Sultan Slimane to re-capture these regions. The Bey of Oran put up no resistance, and with the capture of the region in 1795, the border between the Regency of Algiers and Morocco was definitively fixed at Wadi Kiss. which brought an end to the conflicts between the Algerians and Moroccans.
^Martinière, Maximilien Antoine Cyprien Henri Poisson de La; Lacroix, Napoléon (1894). Documents pour servir à l'étude du Nord Ouest africain: réunis et rédigés par ordre de M. Jules Cambon (in French). Gouvernement général de l'Algérie, Service des affaires indigènes.
^Chenntouf, Tayeb (1981). "L'évolution du travail en Algérie au XIXe siècle". Revue de l'Occident musulman et de la Méditerranée (in French). 31 (1). PERSEE Program: 85–103. doi:10.3406/remmm.1981.1906. ISSN0035-1474.