It was founded by the Almohad Caliph Abd al-Mu'min in 1147, then completely rebuilt shortly after, and probably completed in its current form by Yaqub al-Mansur in 1195.[23] The mosque is made of red stone and brick in a traditional Almohad style, and measures 80 metres (260 ft) in width towards the east and 60 metres (200 ft) to the west along a north to south direction. It was designed so as to prevent anyone gazing in from the minaret to the harems of the king. There are four entrances to the mosque, of which three open directly into the prayer hall.