This was the main royal mosque of the kasbah, renovated or rebuilt by Moulay Isma'il, possibly around 1677, on the site of the former Marinid-era mosque of the kasbah.[1][2] It was accessed through two monumental doorways from Place Lalla Aouda or by another gate located near the qibla (southeastern) wall and accessed directly from the palaces.[6] From the gates on Place Lalla Aouda, the mosque was approached through a small courtyard or walled square (an unusual feature for a mosque), on the southeastern side of which was a madrasa and an ablutions house.[6][34] The mosque itself has its inner courtyard or sahn, surrounded an arched gallery and by the main interior prayer hall to the southeast. Another unusual feature was the two large chambers facing each other on the southwestern and northeastern sides of the courtyard, one of which served as a prayer hall for women and the other as a library.[6][4] The mosque's large green-tiled minaret, prominently visible from Place Lalla Aouda, is similar in form and decoration to that of the Grand Mosque of Meknes in the city.[6]