ḥājib, in Muslim Spain and Mamlūk Egypt, a high government official. The term originally designated a chamberlain, but under the Spanish Umayyads (756–1031) the ḥājib functioned as a chief minister, paralleling the position of vizier (wazīr) in the eastern caliphates. He was the chief representative of the caliph and directed the central secretariat in Córdoba. In 978 effective control of the caliphate was taken over by Ibn Abū ʿĀmir, known as al-Manṣūr (Almanzor in Spanish sources), who was ḥājib to Hishām II. The so-called ʿĀmirid dictatorship, which was continued by al-Manṣūr’s sons and by the ḥājibs, lasted until the outbreak of civil war in Muslim Spain in 1008. In this period of numerous petty kingdoms (1008–91), most rulers, not daring to claim the sacred office of caliph, assumed the title ḥājib instead.
Many other Muslim dynasties had ministers bearing this title, but their functions varied widely—from war minister to chief of finances to superintendent of the palace. Under the Mamlūks in Egypt (1250–1517), the ḥājib arbitrated disputes between amīrs and soldiers. Eventually he became head of the military courts and from this strictly civil position slowly assumed authority in religious questions, generally the domain of qāḍīs (religious judges). In the provinces, the Mamlūks maintained ḥājibs as officers second or third in command after the governors and authorized to take their place in their absence or death.