Mazagan Ambush
In 1640, the Moroccans, led by Sidi al-Ayachi ambushed a Portuguese force from Mazagan, successfully killing most of them, including their commander.
Context
According to Ahmad ibn Khalid an-Nasiri, the city of Azemmour had signed a peace treaty with Mazagan at a time of political turmoil in Morocco. The captain of Mazagan ordered Azemmour to bring their own men for a duel between them. The captain saw the duel between a Portuguese and a Moroccan, until the Portuguese knight won the duel and killed the Moroccan. When the Moroccans saw this, they informed them that this would break the treaty. The captain began taunting them, and the leader of Azemmour then informed Sidi al-Ayachi about this incident. Ayachi then launched his attack on Mazagan.However, according to Portuguese sources, a group of Moroccans came to Mazagan in April and told the captain, Dom Francisco de Mascarenhas, that the Moroccan sultan, Muhammad ibn Sharif, asked the Portuguese for some aid against his enemies, to which he agreed, though his commanders warned him of such an act. Francisco would leave Mazagan on April 11.