The Spanish, with an objective to establish their rule in north Africa, had suffered setbacks from Muslims.
The count sought approval from Spain to atone for his defection and deal with Algerian tribes.
The count arrived at the Banu 'Amir tribe; their chief was Abdulrahman bin Ridwan, who was preparing a campaign to depose the Zayyanid Sultan, Muhammad, and replace him with his younger brother, Abdulla.
Seeing the chance to establish Spanish authority, the Count agreed to support him and dispatched a force of 600 men.
The Spanish expedition almost succeeded; however, on their way back, the Spanish troops were stationed at Tibda fortress, where they were attacked by the Banu Rashid chief and the Sultan vizier, Mansur bin Ghani.