Custodian of the Two Holy Mosques (Arabic: خادم الحرمين الشريفين Khādim al-Ḥaramayn aš-Šarīfayn; Turkish: İki Kutsal Cami'nin Hizmetkârı), sometimes translated as Servant of the Two Noble Sanctuaries or Protector of the Two Holy Cities, is a royal style that has been used by many Islamic rulers including the Ayyubids, the Mamluk Sultans of Egypt, the Ottoman Sultans, and the modern Saudi kings. The title refers to the ruler taking the responsibility of guarding and maintaining the two holiest mosques in Islam, Al-Masjid al-Haram (the Sacred Mosque) in Mecca and Al-Masjid an-Nabawi (the Prophet's Mosque) in Medina.
It is believed that the first person to use the title was Saladin.
After defeating the Mamluks and gaining control of the two Muslim holy cities, Mecca and Medina in 1517, the Ottoman Sultan Selim I adopted the title. Rather than style himself the Ḥākimü'l-Ḥaremeyn (as The Ruler of The Two Holy Cities), he accepted the more pious title Ḫādimü'l-Ḥaremeyn (as The Servant of The Two Holy Cities). This title was used by all subsequent Ottoman Caliph Sultans until Mehmed VI, the last.