Throughout its long history, the city of Marrakesh has gone through many important historical events, the existence of which contributed to 5 major dynasties. It was founded by the first Almoravid ruler, Youssef Ibn Tashfin, in 1062
During this period, palm cultivation began, the construction of many mosques, and Quran teaching houses, along with the walls that were built to fortify the city and protect it from invasions. Thus, Marrakesh became the capital of the state and an important cultural, commercial, and religious center in it. In 1147, the Almohads besieged ( In English: Almohad, this city was occupied for several months, and they demolished a number of its buildings, then built many palaces and religious buildings in it, and among these buildings: the mosque of Koutoubia.
Marrakesh remained under the rule of the Almohads until the end of the thirteenth century, then it was ruled by the Merinids, during whose reign the country’s capital moved to the city of Fez, and in the early sixteenth century the country was ruled by the Saadian.
Marrakesh prospered during their reign, and returned as the capital of the state again, and witnessed the construction of the Badi Palace by Ahmed Al-Mansour, along with many shrines, and after that, the Alaouite city ruled, who restored its walls, and built many mosques in it, and with At the beginning of the twentieth century, Marrakesh came under the French protectorate, which ended in 1956 when the country gained its independence.