It dates back to around 1126 CE when the Almoravid emir Ali ibn Yusuf built the first walls of the city.[1][2] Its name means "Gate of the Tanners" and refers to the nearby tanneries which have been present here since the Almoravid period.[1] It has the most complicated layout of any gate in the city: its passage bends 5 times, in an almost S-like path, passing through two open-air courts and one covered chamber.[3] A staircase in the southeastern corner of the structure grants access to the roof of the gate.[1] Scholars believe, however, that only the central part of the gate (the vaulted chamber) dates back to the original Almoravid gate and that the Almohads added the inner and outer courtyard sections.[3][1] The gate thus originally would have had a "simple" bent entrance (i.e. it turned 90-degrees only once).