The mosque was originally built in the Marinid period in the late 13th or early 14th century, but it has been reconstructed and restored many times since.[1][2][3] An extensive restoration took place in 1882, and the current minaret was built in 1939.[1][3][2]