The mosque holds a shrine which is said to contain the head of John the Baptist, honoured as a prophet by both Christians and Muslims. The head was supposedly found during the excavations for the building of the mosque. The tomb of Saladin stands in a small garden adjoining the north wall of the mosque.
In 2001 Pope John Paul II visited the mosque, primarily to visit the relics of John the Baptist. It was the first time a pope paid a visit to a mosque.
The spot where the mosque now stands was a temple of Hadad in the Aramaean era. The Aramaean presence was attested by the discovery of a basalt orthostat depicting a sphinx, excavated in the north-east corner of mosque. The site was later temple of Jupiter in the Roman era, then a Christian church dedicated to John the Baptist in the Byzantine era.
Initially, the Muslim conquest of Damascus in 636 did not affect the church, as the building was shared by Muslim and Christian worshippers. It remained a church although the Muslims built a mud brick structure against the southern wall so that they could pray. Under the Umayyad caliph Al-Walid I, however, the church was demolished and between 706 and 715 the current mosque built in its place; an indemnity was paid to the Christians in compensation. According to the legend, Al-Walid himself initiated the demolition by driving a golden spike into the church. At that point in time, Damascus was one of the most important cities in the Middle East and would later become the capital of the Umayyad caliphate.