Conversion of non-Muslim houses of worship into mosques began during the life of Muhammad and continued during subsequent Islamic conquests and under the Muslim rule. As a result, numerous churches, synagogues, Zoroastrian and Hindu temples became mosques.
It is related of the Arab commander Amr ibn al-As that he performed the salat (prayer) in a church and Zayd ibn Ali says regarding churches and synagogues, "Perform thy salat in them; it will not harm thee", meaning that churches and synagogues can safely be used as mosques.
According to The Encyclopaedia Britannica, "before the rise of Islam it was revered as a sacred sanctuary and was a site of pilgrimage.. According to Tabarī's account, the pre- islamic deites included Allāt, al-'Uzzā and Manāt, three goddesses worshiped by the Meccans. The Black Stone (al-Hajar-ul-Aswad), still present at the Kaaba was an object of veneration even before Muhammad. A number of poems Mu'allaqat used to be hung around the Kaaba, because it was a major cultural center. Majnun was taken by his parents to visit the shrine after he had become mad with love for Layla. The pagan pantheon of Ka'aba, located in Mecca, was the first non-Muslim sanctuary to be converted into a mosque; this was done by Muhammad himself after he conquered Makkah in January 630.
According to the Islamic beliefs, Muhammad's actions were not a conversion, but a restoration of a mosque established on that site by Abraham, who is considered to be a prophet in Islam. Ka'aba thus became known as the Masjid al-Haram, or Sacred Mosque, the holiest site in Islam.
According to the early Muslim historians, the towns that surrendered without resistance and made treaties with the Muslims received permission to retain their churches and synagogues, while in the towns taken by conquest Jewish and Christian places of worship were seized by the Muslims. Modern historians do not consider the process of transformation of churches into mosques to be as regular as the Muslim historians describe it, but in the course of time, the Muslims appropriated many churches to themselves. From the beginning of the Muslim conquests, the Christians had ceded to the Muslims half of their churches, which were turned into mosques. One of the earliest examples of this kind was in Damascus, where in 705 Umayyad caliph Abd al-Malik took the church of St. John from the Christians and had it rebuilt as a mosque, which is now known as Umayyad Mosque; overall, Abd al-Malik is said to have transformed ten churches in Damascus into mosques. The process of turning churches into mosques was especially intensive in the villages, with the gradual conversion of the people to Islam. During his persecution of the Copts, Abbasid caliph al-Ma'mun turned many churches into mosques, both in Cairo and in Egyptian villages, which had no mosques in the earlier generations of Islam. Fatimid caliph al-Hakim converted numerous churches and synagogues into mosques. During the Reconquista, Christian warriors would just as often appropriate and convert mosques to churches as the Muslims would convert them to their capture.. Some of them had been earlier Visigothic churches and even built on the location of Roman temples. The chief mosque in Palermo was previously a church. After the Crusades, several churches were turned into mosques in Palestine. Ottoman Turks converted into mosques nearly all churches, monasteries, and chapels in Constantinople, including the famous St. Sophia cathedral, immediately after capturing the city in 1453. To make the buildings fit for the mosques, the Turks destroyed the icons, plundering their precious plating in the process, and defaced the frescoes. The Ottoman sultan Mehmet II was the first to perform a Muslim prayer in what had previously been the St. Sophia cathedral. In the winter of 1543-1544 the Toulon Cathedral was transformed into a mosque for the 30,000 crew of the Turkish-Barbary admiral Hayreddin Barbarossa, who were wintered in this Mediterranean port as allies of François I of France.
In many instances mosques were established on the places of Jewish or Christian sanctuaries associated with Biblical personalities who were also recognized by Islam; the practice was particularly common in Palestine. Caliph Umar laid the foundation of Al-Aqsa mosque on the Temple Mount, the most sacred site in Judaism; Dome of the Rock, another Muslim mosque, was also built on the Temple Mount which was an abandoned and disused area for more than 600 years. Upon the capture of Jerusalem, it is commonly reported that Umar refused to pray in the Church of the Holy Sepulchre for fear that later Muslims would then convert it into a mosque in spite of a treaty guaranteeing its safety.The mosque of Job in Ash Shaykh Sa'd, Syria, which previously was a church of Job. Cave of the Patriarchs, the second most holy site in Judaism, was converted into a church during the Crusades before being turned into a mosque in 1266 and henceforth banned to Jews and Christians. In October 2000, during the Al-Aqsa intifada, the tomb of the Hebrew patriarch Joseph, and the yeshiva inside Od Yosef Chai, located in Nablus, was destroyed by a Palestinian mob and immediately rebuilt as a mosque with a dome painted green.
An inscription at the Quwwat Al-Islam Mosque in Delhi states:
The conversion of non-Islamic places of worship into mosques has abated in modern times, as no major territorial acquisitions have been made by Islam in recent times. However, some of the Greek Orthodox churches in Turkey that were left behind by expelled Greeks in 1923 were converted into mosques. A relatively significant surge in church-mosque conversion followed the 1974 Turkish Invasion of Cyprus. Many of the Orthodox churches in Northern Cyprus have been converted, and many are still in the process of becoming mosques. This practice has sparked considerable contempt in the Greek Cypriot community, and is likely to complicate reconciliation with the Turkish Cypriots.
During World War II, the authorities of the Nazi puppet Independent State of Croatia tried to ally with the Bosniaks, whom they considered to be "Muslim Croats". As a token, the Artists' Gallery museum (by Ivan Meštrović) in Zagreb was furnished with minarets and ceded to be used as a mosque.
In many areas with surges in a new Islamic population (e.g. the United States and the United Kingdom), buildings once housing churches and other religious congregations have been converted into mosques due to a decrease in Christian religiosity.
Conversion of Hellenic temples into Churches:
Conversion of Churches into Mosques and converted back into Churches:
Conversion of Hindu temples into Mosques and converted back into Hindu temples: