In 661, Muawiyah was crowned Caliph in Jerusalem, becoming the first of the (Damascus-based) Umayyad dynasty. In 691, Umayyad Caliph Abd al-Malik (685-705) constructed the Dome of the Rock shrine on the Temple Mount (where the Jewish temple had been located). A second building, the Al-Aqsa Mosque, was also erected on the Temple Mount in 705. Both buildings were rebuilt in the 10th century following a series of earthquakes.