In the late 16th century the Saadians built a kasbah (citadel or fortified enclosure), called Kasbah Tamdert, just north of the gate and inside the city walls, most likely to help maintain control over the hostile local population.