Article snapshot taken from Wikipedia with creative commons attribution-sharealike license.
Give it a read and then ask your questions in the chat.
We can research this topic together.
City gate in Marrakesh, Morocco
For the gate of the same name in Meknes, see Bab el-Khemis (Meknes).
The gate is located in the northern/northeastern corner of the city walls and dates back to around 1126 CE when the AlmoravidemirAli ibn Yusuf built the first walls of the city. It was originally known as Bab Fes ("Gate of Fes"), but this name was apparently lost during the Marinid era. The gate underwent a significant renovation in 1803–04 on the orders of Sultan Moulay Slimane, noted by a marble inscription found inside.
The gate's current name (el-Khemis) refers to the souk or open-air market which historically took place here every Thursday (al-Khamis in Arabic). Nowadays, the market continues almost all week right outside the gate, while a permanent flea market, Souk al-Khemis, has been constructed a few hundred meters to the north. Also just outside the gate is a qubba (domed mausoleum) housing the tomb of a local marabout or Muslimsaint.
Architecture
The gate's outer entrance is flanked on either side by square bastions. The gate's passage originally consisted of a bent entrance which effected a single 90-degree turn; one entered the gate from the north and then exited westwards into the city. According to legend, the door leaves of the gate were brought from Spain by a victorious Yusuf ibn Tashfin. During the Almohad period, the gatehouse was expanded such that its passage effected three more right-angle turns before exiting southwards. This gave it a similar form and layout to several other major Almohad gates such as Bab er-Rouah. The outline of the gate's original exit, now walled-up, can still be seen in its interior western wall.
At some point in the 20th century, the inner wall of the passage was opened up to allow a straight passage directly through the gate in order to facilitate the heavy traffic in the area, resulting in the current form of the gate.