The mosque was the first mosque founded by Idris I, in 808 CE, when he founded "Madinat Fas", the first city of what became Fes, centered on what is now the Andalous or 'Adoua quarter (on the eastern shore of the Bou Khareb River).