The earlier church which lays on the site was dedicated to St John the Baptist. Legend has it that the casket containing John the Baptist's remains were buried underground and discovered in the 8th century when the mosque was being built.