The mosque was built in 1455 on the orders of Sayf al-Din Birdibak al-Ashrafi, the dawadar of the Mamluk sultan Sayf al-Din Inal. Birdibak was highly religious and convened an annual conference to discuss the hadith of the 9th-century Muslim scholar Muhammad al-Bukhari. He reached high positions within the Mamluk state and built two other Friday mosques in Damascus and Cairo. The Mahkamah Mosque was originally part of a madrasa, and education served as the building's principal function. Prayers were also held regularly and on Fridays. During Ottoman rule between the 16th and early 20th centuries, the school functioned as a courthouse for the city's qadis, hence its Arabic nameal-Mahkamah In the late 19th-century Swiss scholar Max van Berchem found a Kufic inscription fixed over the mihrab of the mosque that belonged to the tombstone of Muhammad ibn al-Abbas al-Hashimi, a member of the Hashemite family who had died in Gaza in the late 9th-century. On top of the mosque's entrance is the foundation inscription crediting Birdibak for the mosque's construction and honoring Sultan Inal. During the British Mandate period following World War I it served as boy's religious school under the name Madrasa al-Shuja‘iyya al-Amiriyya. The mosque was destroyed by the Israeli airforce in Operation "Protective Edge".
Architecture
The mosque was constructed in the Burji Mamluk style. It serves as a unique example of Mamluk architecture, having been highly influenced by earlier Ayyubid mosque-madrasas. In particular, the niches of the northern facade strongly resemble the architectural elements of Ayyubid structures in Egypt and Syria. The complex consists of a central sahn situated 1.2 meters below street level. There are several ablution places in the courtyard area. North of the courtyard is the facade where the main entrance is located. The entrance portal is topped by a pointed arch with floral decorations. The northern part of the mosque consists of the entrance hall and three other rectangular-shaped rooms each measuring 3.77 meters by 3.69 meters. Each room, including the entrance hall, is topped by a small dome. The southern part of the complex was laid out in a similar manner, but is in ruins. The rooms on both sides of the mosque served as lodging for the sheikh and his students and provided other services as well. This particular layout makes the Mahkamah Mosque the only madrasa of its kind still standing in Gaza. The courtyard is bordered to the southwest by the iwan. The iwan is divided into three sections and is the largest part of the mosque complex. The central portion serves as the principal section and is covered by a fan-shaped cross vault. It contains the mihrab and the minbar. The minbar is adorned with marble paneling, floral motifs and Qur'anic inscriptions. The main section is bordered by two smaller outer sections with barrel vaulting and pointed arches connecting both structures with the main section. In the northwest, a smaller Mamluk-era iwan that previously faced the main iwan is extant. The western facade is mostly in ruins as well. In the northwestern corner of the mosque is the Mamluk-style minaret. The base of the minaret is rectangular, while the shaft is composed of two octagonal stories topped by the octagonal muezzin's gallery. The sides of the base contain niches that "alleviate the austerity of the structure" according to Islamic art researcher Mu'en Sadeq. The octagonal levels of the minaret's body are designed with embrasures decorated with translucent floral and geometric ornamentation. The embrasures allow light and ventilation into the interior spiral staircase that leads to the muezzin's gallery which rests on stone muqarnas.