The walled precinct at the centre of Damascus has been a place of worship for close to three thousand years without interruption of use. An Aramaean temple of the storm god Hadad stood there in the first millennium BCE; the Romans rebuilt it on a monumental scale for Jupiter Damascenus, and the outer enclosure wall of that sanctuary is still the wall of the mosque. In the Christian centuries a church of John the Baptist occupied part of the site.
The Umayyad caliph al-Walid took over the whole precinct and built the congregational mosque between 706 and 715, and it became the model for much of what a great mosque would be: a broad prayer hall of three aisles running parallel to the qibla wall, a courtyard, and a facade of glass mosaic showing rivers, trees and palaces with no living figure in it. Enough of that mosaic survives to show what early Islamic art looked like when it was new. A shrine inside the prayer hall is venerated as holding the head of John the Baptist, called Yahya in the Quran, and it is honoured by Muslim and Christian visitors alike.
The city kept its layers afterwards. Saladin is buried in a small tomb against the north wall of the mosque. The Andalusian mystic Ibn Arabi died in Damascus in 1240 and his tomb in the Salihiyya quarter became a shrine with an Ottoman mosque built over it, while Ibn Taymiyya, who spent his life attacking exactly that kind of veneration, died in the city's citadel prison in 1328 and is buried a short walk away.