	From the 10th century to the early 20th century, Mecca and Medina were under the control of a local Arab ruler known as the Sharif of Mecca, but at most times the Sharif owed allegiance to the ruler of one of the major Islamic empires based in Baghdad, Cairo or Istanbul. Most of the remainder of what became Saudi Arabia reverted to traditional tribal rule.