After the Muslim conquest of Damascus in 634, the mosque was built on the site of a Christian basilica dedicated to John the Baptist, honored as a prophet by both Christians and Muslims. A legend dating to the sixth century holds that the building contains the head of John the Baptist. Two shrines commemorating Husayn ibn Ali (), whose martyrdom is frequently compared to that of John the Baptist and Jesus Christ, exist within the building premises. The mosque is also believed by Muslims to be the place where Jesus will return before the End of Days. The mausoleum containing the tomb of Saladin stands in a small garden adjoining the north wall of the mosque.