According to Othmane El Achari, the mosque was originally called the mosque of Sultan
Muḥammad III b. ʿAbd Allāh (), then as the Great Mosque () as it was the largest mosque in the port city. It was then called Dar al-Makhzen Mosque for the neighboring
Makhzen building, which later became the shrine of Sidi Bousmara. According to Mustapha Naciri, the Makhzen building was originally a
mahkama in which a group of who would adjudicate general and social cases. == History ==