Al-Aqsa Mosque, located in the Old City of Jerusalem, is the third holiest site in Islam. The mosque was built on top of the Temple Mount, known as the Al Aqsa Compound or Haram esh-Sharif in Islam, several decades after Muhammad's death. Modern Muslims believe that Muhammad was transported from the Great Mosque of Mecca to this location during the Night Journey. Islamic tradition holds that Muhammad led prayers towards this site until the 16th or 17th month after his migration from Mecca to Medina, when Allah directed him to instead turn towards the Kaaba in Mecca.
The covered mosque building was originally a small prayer house erected by Umar, the second caliph of the Rashidun Caliphate, after the Muslim conquest of the Levant in the early 7th century. It was rebuilt and expanded by the Umayyad caliph Abd al-Malik and finished by his son al-Walid in 705. The mosque was completely destroyed by an earthquake in 746 and rebuilt by the Abbasid caliph al-Mansur in 754. It was rebuilt again in 780. Another earthquake destroyed most of al-Aqsa in 1033, but two years later the Fatimid caliph Ali az-Zahir built another mosque whose outline is preserved in the current structure.