 In 1517, the then Sharif of Makkah, Barakat bin Muhammad, acknowledged the supremacy of the Ottoman Caliph but retained a great degree of local autonomy.In 1803 the city was captured by the First Saudi State, which held Mecca until 1813. destroying some of the historic tombs and domes in and around the city.The Ottomans assigned the task of bringing Makkah back under Ottoman control to their powerful "Khedive" (viceroy) and "Wali" of Egypt, Muhammad Ali Pasha.