The madrasa dates back to the 10th century, and predates the mosques of Al-Qasr. The main congregation hall, which served as both lecture room and prayer hall is really nice, with painted liwans (see top picture) which were used as libraries. A madrasa was a mixture of a high school and a university, an all subjects were related to Islam, with perhaps law as the most important.