The Ayyubid Mosque of Omar (Arabic: مسجد عمر بن الخطاب) in Jerusalem is located opposite the southern courtyard of the Church of the Holy Sepulchre in the Muristan area of the Christian Quarter.
According to later documents, after the Siege of Jerusalem in 637 by the Rashidun army under the command of Abu Ubaidah ibn al-Jarrah, Patriarch Sophronius refused to surrender except to the Caliph Omar (579-644) himself. Omar travelled to Jerusalem and accepted the surrender. He then visited the Church of the Resurrection (today better known as the Church of the Holy Sepulchre) where Sophronius invited him to pray inside the church, but Omar declined so as not to set a precedent and thereby endanger the church's status as a Christian site. Instead he prayed outside, on the steps east of the church, in a place where David was believed to have prayed. The legend seems anachronistic, since in the first decades of Muslim rule in Syria and Palestine the common use of churches by Christians and Muslims was a common occurrence. However, a "Mosque of Omar" was apparently later built at that site, as proven by a stone plate with a Kufic inscription found in 1897 in the area of the eastern or outer atrium of the Constantinian (4th-century) Church of the Resurrection, defining this area as a mosque.
The current Mosque of Omar, which is at a totally different site than the one where Caliph Omar has allegedly prayed and where the earlier mosque was located, since it stands to the south of the church rather than to the east of it, was built in its current shape by the Ayyubid Sultan Al-Afdal ibn Salah ad-Din in 1193 in memory of this event. This new position is likely due to the fact that the entrance to the Church of the Holy Sepulchre had by then moved from the east to the south of the church, as a result of repeated destructive events that affected the Holy Sepulchre during the 11th and 12th centuries.
The Ayyubid mosque has a 15 metres (49 ft) high minaret that was built sometime before 1465 during the Mamluk period, and was renovated by Ottoman sultan Abdulmecid I (1839–1860).