Al-Aqsa (; Arabic: الأَقْصَى, romanized: Al-Aqṣā) or al-Masjid al-Aqṣā (Arabic: المسجد الأقصى) is the compound of Islamic religious buildings that sit atop the Temple Mount, also known as the Haram al-Sharif, in the Old City of Jerusalem, including the Dome of the Rock, many mosques and prayer halls, madrasas, zawiyas, khalwas and other domes and religious structures, as well as the four encircling minarets. It is considered the third holiest site in Islam. The compound's main congregational mosque or prayer hall is variously known as Al-Aqsa Mosque, Qibli Mosque or al-Jāmiʿ al-Aqṣā, while in some sources it is also known as al-Masjid al-Aqṣā; the wider compound is sometimes known as Al-Aqsa Mosque compound in order to avoid confusion.
During the rule of the Rashidun caliph Umar (r. 634–644) or the Umayyad caliph Mu'awiya I (r. 661–680), a small prayer house on the compound was erected near the mosque's site. The present-day mosque, located on the south wall of the compound, was originally built by the fifth Umayyad caliph Abd al-Malik (r. 685–705) or his successor al-Walid I (r. 705–715) (or both) as a congregational mosque on the same axis as the Dome of the Rock, a commemorative Islamic monument. After being destroyed in an earthquake in 746, the mosque was rebuilt in 758 by the Abbasid caliph al-Mansur (r. 754–775). It was further expanded upon in 780 by the Abbasid caliph al-Mahdi (r. 775–785), after which it consisted of fifteen aisles and a central dome. However, it was again destroyed during the 1033 Jordan Rift Valley earthquake. The mosque was rebuilt by the Fatimid caliph al-Zahir (r. 1021–1036), who reduced it to seven aisles but adorned its interior with an elaborate central archway covered in vegetal mosaics; the current structure preserves the 11th-century outline.