The Divriği mosque is an outstanding example of Selçuk mosques in Anatolia, having neither a courtyard, colonnades, nor an uncovered ablutions basin, but which (owing perhaps to the harshness of the climate) organizes all religious functions in an enclosed area. A charitable foundation, the contiguous hospital makes an already exceptional ensemble even more interesting thanks to a princely command.

Far away from the major communication links at the south-east of Sivas province in eastern Anatolia, the mountainous region of Divriği (Tephrike in the Byzantine Empire) was a 12th-century refuge for the Paulician Christian sect which was persecuted by Basil I and then by John Tzimisces, who exiled their survivors to Thrace. From there the heresy gradually moved westward, gaining followers of varying degrees of loyalty such as the Bogarmils or Cathars.

After 1071, Divriği fell to the Turks. In 1118 the city was given to Mengücek Bey and the dynasty of the Mengücekids governed the province virtually without interruption until the Mongol occupation in 1277.

The rectangular ensemble of buildings, which occupies the south-west slope of the hill from which Divriği Castle rises, dates back to this first Turkish period. There is a mosque which was founded in 1228-29 by the Mengücekid emir, Ahmet Shah, and a marestan (hospital for the insane) endowed by his wife, Malikaturan Malik. These two complementary monuments were built simultaneously by the same architect, Khurramshad of Ahlat.

The sole prayer room in the great mosque has five aisles, each consisting of five bays. It has stone vaulting and above are two cupolas of unequal size. One is above the ablutions basin and the other is above the mihrab (prayer niche). The second cupola is the principal one, recognizable from the exterior by its hexagonal spire.

With its ribwork on pendentives, it is the most refined piece of architecture that the mosque has to offer. Yet each of the 16 remaining vaults is an amazing technical feat: the vaulting of the hospital room is comparable in scientific achievement, making use of a spacious design of perfectly pure lines. The principal nave opens towards the east on an iwan (three-sided, vaulted hall open at one end) and laterally on to two iwans flanked by small rooms. Such a layout makes possible isolation as well as contact in a communal area.