according to the muslim apocryphal treaty pact of umar, caliph umar ibn al-khattab came to jerusalem in 637 after the conquest of jerusalem and toured the city with sophronius. during the tour of the church of the holy sepulchre, the time for prayer came, and despite sophronius'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 appreciating the caliph's intelligence he 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.