Usually, the Koutoubia is a double mosque, both parts dating from the reign of the second Almohad leader, Abdel Mumin (1130-1163). Standing on the esplanade facing the minaret, the ruins of the first Koutoubia are behind railings to your right (first excavated in the late 1940s, and re-explored recently). The bases of the prayer hall's culumns, and the cisterns under the courtyard are clearly visible. The ground plan of the second Koutoubia, still standing, is the same as that of the ruined one (17 naves). The Almohad Mosque at Tin Mal, visitable for non-muslims, has a similar plan.
So why, back in the 12 century, did the Almohads go the trouble of building not one but two mosques? Why bother destroying the Almoravid Mosque? (the site of the mosque is itself historic, originally occupied by a late 11th century Kasbah, the Almoravid Dar El Hajar.)
The successful Almohads destroyed much of the Almoravid city, and in 1147 built a large mosque, close to the fortress. In all likelyhood they had to do this for puritain as they were and considering the Almoravids to be heretics, they could not pray in a tainted building. Unfortunately, the orientation of the new Almohd mosque was not quite right - the focus point in a mosque is the direction of Mecca, indicated by the mihrab. The solution was to build a second mosque -the present Koutoubia-even though the faithful at prayer can correct this directional problem themselves, under the direction of the Imam, once the right direction has been workd out.
Thus two mosques existed side by side for some time, the first probably functionning as a sort of annexe. Given Almohad's religious fervour, the congregations were no doubt large. Today, the bricked-up spaces on the Northwest wall of the Koutoubia Mosque ondocate the doors which connected them. However, the complex was excessive in size and the older structure fell in disrepair eventual ruin. The excavations of 1948 also revealed a maqsura or screen in front of the mihrab, which could be wound up through the floor to protect the sultan and minbar, or pulpit, which was moved into positions on wooden rollers. The two cisterns in the center may have been from a previous Almoravid structure. On the eastern flank of this mosque was an arcade from which a niche and the remains of one arch remain.

History
Liens
Marrakesh
the Koutoubia
The Badi Palace -Museum of Moroccan Arts and Crafts-Maison Tiskiwin -Bahia Palace- The jewish quarter