Amir Khayrbak was appointed viceroy of Aleppo by Sultan al-Ghuri, whom he then betrayed by defecting to the Ottoman side in the battle of Marj Dabiq near Aleppo in 1516. A year later, the Ottoman Sultan Selim, the new master of Egypt, conferred the vice-regency of Egypt upon him in recognition of his defection. In 1520 he added a madrasa-mosque and a sabil-kuttab to his mausoleum, which he had built in 1502. To this new complex he annexed the adjacent Palace of Amir Alin Aq (built in 1293), in which he took up residence. This complex serves as an example of a foundation the construction of which straddles two eras.
The juxtaposition of the sabil-kuttab, bent entrance, prayer hall, and mausoleum created two sets of protrusions. The first, consisting of the sabil-kuttab and the bent entrance, follow the street's alignment; the second, following the prayer hall and the mausoleum, is oriented towards Mecca. The two sets of protrusions, combined with the square-octagonal-cylindrical minaret and the dome with an elaborate exterior zone of transition made up of half prisms, present an unusual volumetric composition with contrasting forms counterbalancing each other.
The prayer hall is covered with three cross-vaults supported by pointed arches. The two-layered, tapestry-like carving on the exterior of the stone dome is a simplified version of the intricate theme introduced on the dome over the mausoleum of Sultan Qaytbay (1472-74). The two layers on Qaytbay's dome are distinguished from one another by movement -- one comprising a geometrical pattern and the other an undulating arabesque -- and by contrasting surface articulation. This dynamic equilibrium between the two patterns is further accentuated by a difference in planes. The two interlacing, uniplanar arabesque layers on the dome of Khayrbak exhibit similar contrasting surface articulation.
The minaret is built of brick, and its shaft is decorated with star-shaped patterns carved in stucco. The threshold is made from a block of stone from a pharaonic building. The custodian claims that the hieroglyphic inscriptions, which include a figure of the mummified Osiris, have kept all flies and insects out of the mosque.