After defeating the Mamluks and gaining control of Mecca and Medina in 1517, the Ottoman sultan Selim I adopted the title. It was used by all subsequent sultans until Mehmed VI, the last.
The first Saudi king to assume the title was Fahd bin Abdul Aziz in 1986. King Fahd replaced the term "His Majesty" with "Custodian of the Two Holy Mosques". The reigning king, Salman bin Abdulaziz Al Saud, took the same title after the death of King Abdullah, his half brother, on January 23, 2015.