Indeed, when the Muslims came to Syria on more than one occasion, accompanied by Umar ibn al-Khattāb, Uthmān ibn Affān, Ali ibn Abī Tālib, and others; then (1) when Umar came for the conquest of Jerusalem; then when he came to levy the jizyah upon the protected non-Muslim subjects and agree terms with them; and then when he came to Sargh (2)—on every one of these occasions (3), none of them undertook a journey to the grave (4) of Abraham, the Friend of Allah. Nor was there any shrine there. Rather, there was only the structure erected over the cave, and it was sealed off (5), with no door [to it] (6), like the chamber (7) of the Prophet—may Allah bless him and grant him peace.
This remained the case throughout the caliphates of the Umayyads and the Abbasids, until the Christians took possession of those lands late in the fifth century AH. They built that structure and made it into a church [and cut an entrance through the structure; hence, the doorway is cut through rather than built into it] (8). Then, when the Muslims recovered that land from them, whoever chose to do so made it into a mosque.
Indeed, whenever the Companions saw that someone had built a mosque over a grave, they forbade him to do so. When the grave of Daniel came to light at Tustar (9), Abū Mūsā al-Asharī—may Allah be pleased with him—wrote concerning it—