The mosque was built around the tomb of Muhammad ben Salah, whose tomb it contains, in the early 14th-c.