 Today it serves as a museum.The mosque was founded in 1296 by the emir Abi Ibrahim ibn Yahya during the Zayyanid era as inscribed on the plank of the western wall in the prayer hall, as well as the two groves made of gypsum on top of the mihrab.The current name of the mosque is considered derived from the name of the local qadi and ulama Abi al-Hassan who served under the rule of the Sultan Abi Sayeed Uthman (1283-1303).