The Sharif Ismail and his sons carried out various expeditions in Algerian territory between 1640 and 1701 with the support of certain marabouts.
[1][2] The presence of the Spaniards in Oran allowed the Algerians to benefit from the status of fighters (ghazis) in the holy war against the Christian invaders.
It was in this context of rivalry that Ismail Ibn Sharif made an attempt in 1693 to capture Oran, and possible more territory.
These repeated incursions by Moulay Ismael into western Algeria led to the only period when a Spanish-Algerian alliance existed.
Moulay Ismael is said to have declared following his failed attempt: Oran is like a viper sheltered under a rock: woe betide the imprudent person who touches it!Following these events, the Sultan of Constantinople sent an embassy to invite Moulay Ismaïl to make peace with the Algerians and to respect their territory; the Sultan of Morocco accepted this invitation.