According to the Pact of Umar,* which has canonical status in Islamic jurisprudence, caliph Umar ibn al-Khattab came to Jerusalem in 637 after the conquest of Jerusalem and toured the city with Patriarch Sophronios of Jerusalem. During the tour of the Church of the Holy Sepulchre, the time for prayer came, and despite Sophronios's offer to Umar to pray inside the church, Umar chose to pray outside. According to Islamic tradition, the caliph's reason for declining to pray there was because in the future Muslims might say that Umar prayed here and use it as an excuse to build a mosque there. Therefore, Muslims are not allowed to build a mosque there. So Umar went outside the church, picked up a stone and threw it at a distance. He offered his prayers at the spot where the stone fell. And as he predicted, later when the Ayyubids reached that region, they built a mosque at that same spot where Umar ibn al-Khattab had offered the prayers, known today as the Mosque of Umar. Patriarch Sophronios, appreciating the caliph's intelligence, gave the keys of the church to him. Unable to refuse it the caliph gave it to a family of Muslims from Medina and asked them to open the church and close it; the keys of the Church of the Holy Sepulchre still remain with the Muslim family to this day.
Earlier, the Prophet Muhammad also abided by this principle. In 623, the Prophet of Islam authorized a letter of protection for the Sinai Monastery (also known as the Saint Katherine's Monastery or the Sacred Monastery of the God-Trodden Mount Sinai) in Egypt. This letter of protection, known as the Ahtiname of Muhammad, or the Covenant or Testament of Muhammad, upheld the principles of peace and tolerance between communities. The Ahtiname from the Prophet of Islam (to the Sinai Monastery) stated that, “No one is allowed to plunder these Christians, or destroy or spoil any of their churches, or houses of worship, or take any of the things contained within these houses and bring it to the houses of Islam.”
The Prophet of Islam and his followers were thus proponents of a certain level of tolerance, mutual respect and co-existence with members of other religions in the societies they conquered and occupied, as long as they confessed one God. They practiced this in every sense of the word. Any action that could cause dissension and unrest in the society was forsaken for the greater good, that is, peace. The only factor was that Islam was to be the preeminent religion in society, though without violating the sacred space of other religions which they viewed as lesser than theirs. Otherwise, if such a principle is violated, Islam can no longer claim to be a religion of peace, but of violence and plunder.
Notes:
* In general, the pact contains a list of rights and restrictions on non-Muslims (dhimmis). By abiding by them, non-Muslims are granted the security of their persons, their families, and their possessions.