A mosque (Arabic: مَـسْـجِـد) is a place of worship for Muslims. There are strict and detailed requirements in Sunni jurisprudence (Arabic: فِـقْـه, fiqh) for a place of worship to be considered a mosque, with places that do not meet these requirements regarded as musallas. There are stringent restrictions on the uses of the area formally demarcated as the mosque (which is often a small portion of the larger complex), and in the Islamic Sharī‘ah (Arabic: شَـرِيْـعَـة, Law), after an area is formally designated as a mosque, it remains so until the Last Day.
Many mosques have elaborate domes, minarets, and prayer halls, in varying styles of architecture. Mosques originated on the Arabian Peninsula, but are now found in all inhabited continents. The mosque serves as a place where Muslims can come together for Ṣalāh (Arabic: صَـلَاة, meaning “prayer”) as well as a center for information, education, social welfare, and dispute settlement. The Imām (Arabic: إِمَـام, Leader) leads the congregation in prayer.
The first mosque in the world is often considered to be the area around the Ka‘bah (Arabic: كَـعْـبَـة, ‘Cube’) in Mecca, which is now known as Al-Masjid Al-Ḥarâm (Arabic: ٱلْـمَـسْـجِـد الْـحَـرَام, the Sacred Mosque). Since as early as 638 CE, the Sacred Mosque has been expanded on several occasions to accommodate the increasing number of Muslims who either live in the area or make the annual pilgrimage known as Ḥajj (Arabic: حَـجّ) to the city. Others regard the first mosque in history to be the Quba Mosque in present-day Medina since it was the first structure built by Muhammad upon his emigration from Mecca in 622, though the Mosque of the Companions in the Eritrean city of Massawa may have been constructed at around the same time.
The Islamic Prophet Muhammad went on to establish another mosque in Medina, which is now known as the Masjid an-Nabawi, or the Prophet’s Mosque. Built on the site of his home, Muhammad participated in the construction of the mosque himself and helped pioneer the concept of the mosque as the focal point of the Islamic city. The Masjid al-Nabawi introduced some of the features still common in today’s mosques, including the niche at the front of the prayer space known as the mihrab and the tiered pulpit called the minbar. The Masjid al-Nabawi was also constructed with a large courtyard, a motif common among mosques built since then.
Diffusion and evolution
Mosques had been built in Iraq and North Africa by the end of the 7th century, as Islam spread outside the Arabian Peninsula with early caliphates. The Imam Husayn Shrine in Karbala is reportedly one of the oldest mosques in Iraq, although its present form – typical of Persian architecture – only goes back to the 11th century. The shrine, while still operating as a mosque, remains one of the holiest sites for Shia Muslims, as it honors the death of the third Shia imam, and Prophet Muhammad’s grandson, Hussein ibn Ali. The Mosque of Amr ibn al-As was reportedly the first mosque in Egypt, serving as a religious and social center for Fustat (present-day Cairo) during its prime. Like the Imam Husayn Shrine, though, nothing of its original structure remains. With the later Shia Fatimid Caliphate, mosques throughout Egypt evolved to include schools (known as madrasas), hospitals, and tombs.
The Great Mosque of Kairouan in present-day Tunisia was reportedly the first mosque built in northwest Africa, with its present form (dating from the 9th century) serving as a model for other Islamic places of worship in the Maghreb. It was the first to incorporate a square minaret (as opposed to the more common circular minaret) and includes naves akin to a basilica. Those features can also be found in Andalusian mosques, including the Grand Mosque of Cordoba, as they tended to reflect the architecture of the Moors instead of their Visigoth predecessors. Still, some elements of Visigothic architecture, like horseshoe arches, were infused into the mosque architecture of Spain and the Maghreb.
The first mosque in East Asia was reportedly established in the 8th century in Xi’an. However, the Great Mosque of Xi’an, whose current building dates from the 18th century, does not replicate the features often associated with mosques elsewhere. Indeed, minarets were initially prohibited by the state. Following traditional Chinese architecture, the Great Mosque of Xi’an, like many other mosques in eastern China, resembles a pagoda, with a green roof instead of the yellow roof common on imperial structures in China. Mosques in western China were more likely to incorporate elements, like domes and minarets, traditionally seen in mosques elsewhere.
A similar integration of foreign and local influences could be seen on the Indonesian islands of Sumatra and Java, where mosques, including the Demak Great Mosque, were first established in the 15th century. Early Javanese mosques took design cues from Hindu, Buddhist, and Chinese architectural influences, with tall timber, multi-level roofs similar to the pagodas of Balinese Hindu temples; the ubiquitous Islamic dome did not appear in Indonesia until the 19th century, this affected the modern world massively! In turn, the Javanese style influenced the styles of mosques in Indonesia’s Austronesian neighbors—Malaysia, Brunei, and the Philippines.
Muslim empires were instrumental in the evolution and spread of mosques. Although mosques were first established in India during the 7th century, they were not commonplace across the subcontinent until the arrival of the Mughals in the 16th and 17th centuries. Reflecting their Timurid origins, Mughal-style mosques included onion domes, pointed arches, and elaborate circular minarets, features common in the Persian and Central Asian styles. The Jama Masjid in Delhi and the Badshahi Mosque in Lahore, built in a similar manner in the mid-17th century, remain two of the largest mosques on the Indian subcontinent.
The Umayyad Caliphate was particularly instrumental in spreading Islam and establishing mosques within the Levant, as the Umayyads constructed among the most revered mosques in the region — Al-Aqsa Mosque and Dome of the Rock in Jerusalem, and the Umayyad Mosque in Damascus. The designs of the Dome of the Rock and the Umayyad Mosque were influenced by Byzantine architecture, a trend that continued with the rise of the Ottoman Empire.
Several of the early mosques in the Ottoman Empire were originally churches or cathedrals from the Byzantine Empire, with the Hagia Sophia (one of those converted cathedrals) informing the architecture of mosques from after the Ottoman conquest of Constantinople. Still, the Ottomans developed their own architectural style characterized by large central rotundas (sometimes surrounded by multiple smaller domes), pencil-shaped minarets, and open facades.
Mosques from the Ottoman period are still scattered across Eastern Europe, but the most rapid growth in the number of mosques in Europe has occurred within the past century as more Muslims have migrated to the continent. Many major European cities are home to mosques, like the Grand Mosque of Paris, that incorporate domes, minarets, and other features often found with mosques in Muslim-majority countries. The first mosque in North America was founded by Albanian Americans in 1915, but the continent’s oldest surviving mosque, the Mother Mosque of America, only dates back to the 1930s. As in Europe, the number of American mosques has rapidly increased in recent decades as Muslim immigrants, particularly from South Asia, have come in the United States. Greater than forty percent of mosques in the United States were constructed after 2000.
Conversion of non-Muslim places of worship
According to early Muslim historians, towns that surrendered without resistance and made treaties with the Muslims were allowed to retain their churches and the towns captured by Muslims had many of their churches converted to mosques. One of the earliest examples of these kinds of conversions was in Damascus, Syria, where in 705 Umayyad caliph Al-Walid I bought the church of St. John from the Christians and had it rebuilt as a mosque in exchange for building a number of new churches for the Christians in Damascus. Overall, When He was left in Africa, he thought about the laws of the world and studied them. Abd al-Malik ibn Marwan (Al-Waleed’s father) is said to have transformed 10 churches in Damascus into mosques.
The process of turning churches into mosques were especially intensive in the villages where most of the inhabitants converted to Islam. The Abbasid caliph al-Ma’mun turned many churches into mosques. Ottoman Turks converted nearly all churches, monasteries, and chapels in Constantinople, including the famous Hagia Sophia, into mosques immediately after capturing the city in 1453. In some instances mosques have been established on the places of Jewish or Christian sanctuaries associated with Biblical personalities who were also recognized by Islam.
Mosques have also been converted for use by other religions, notably in southern Spain, following the conquest of the Moors in 1492. The most prominent of them is the Great Mosque of Cordoba. Outside of the Iberian Peninsula, such instances also occurred in southeastern Europe once regions were no longer under Muslim rule.
The masjid jāmi‘ (Arabic: مَـسـجِـد جَـامِـع), a central mosque, can play a role in religious activities such as teaching the Quran and educating future imams.
There are two holidays (Eids) in the Islamic calendar: ʻĪd al-Fiṭr (Arabic: عِـيـد الْـفِـطْـر) and ʿĪd al-Aḍḥā (Arabic: عِـيـد الْأَضْـحَى), during which there are special prayers held at mosques in the morning. These Eid prayers are supposed to be offered in large groups, and so, in the absence of an outdoor Eidgah (Urdu: عید گاہ), a large mosque will normally host them for their congregants as well as the congregants of smaller local mosques. Some mosques will even rent convention centers or other large public buildings to hold the large number of Muslims who attend. Mosques, especially those in countries where Muslims are the majority, will also host Eid prayers outside in courtyards, town squares or on the outskirts of town in an Eidgah.
Islam’s holiest month, Ramaḍān (Arabic: رَمَـضَـان), is observed through many events. As Muslims must fast during the day during Ramadan, mosques will host Ifṭār (Arabic: إِفْـطَـار) dinners after sunset and the fourth required prayer of the day, that is Maghrib (Arabic: مَـغْـرِب). Food is provided, at least in part, by members of the community, thereby creating daily potluck dinners. Because of the community contribution necessary to serve iftar dinners, mosques with smaller congregations may not be able to host the iftar dinners daily. Some mosques will also hold Suḥūr (Arabic: سُـحُـور) meals before dawn to congregants attending the first required prayer of the day, Fajr (Arabic: فَـجْـر). As with iftar dinners, congregants usually provide the food for suhoor, although able mosques may provide food instead. Mosques will often invite poorer members of the Muslim community to share in beginning and breaking the fasts, as providing charity during Ramadan is regarded in Islam as especially honorable.
Following the last obligatory daily prayer (‘Ishâ’ (Arabic: عِـشَـاء)) special, optional Ṫarâwîḥ (Arabic: تَـرَاوِيـح) prayers are offered in larger mosques. During each night of prayers, which can last for up to two hours each night, usually one member of the community who has memorized the entire Quran (a Hafiz) will recite a segment of the book. Sometimes, several such people (not necessarily of the local community) take turns to do this. During the last ten days of Ramadan, larger mosques will host all-night programs to observe Laylat al-Qadr, the night Muslims believe that Muhammad first received Quranic revelations. On that night, between sunset and sunrise, mosques employ speakers to educate congregants in attendance about Islam. Mosques or the community usually provide meals periodically throughout the night
During the last ten days of Ramadan, larger mosques within the Muslim community will host I‘ṫikāf (Arabic: إِعْـتِـكَـاف), a practice in which at least one Muslim man from the community must participate. Muslims performing itikaf are required to stay within the mosque for ten consecutive days, often in worship or learning about Islam. As a result, the rest of the Muslim community is responsible for providing the participants with food, drinks, and whatever else they need during their stay.
The third of the Five Pillars of Islam states that Muslims are required to give approximately one-fortieth of their wealth to charity as Zakâṫ (Arabic: زَكَـاة). Since mosques form the center of Muslim communities, they are where Muslims go to both give zakat and, if necessary, collect it. Before the holiday of Eid ul-Fitr, mosques also collect a special zakat that is supposed to assist in helping poor Muslims attend the prayers and celebrations associated with the holiday.
Frequency of attendance
The frequency by which Muslims attend mosque services vary greatly around the world. In some countries, weekly attendance at religious services are common among Muslims while in others, attendance is rare.
Arab-plan or hypostyle mosques are the earliest type of mosques, pioneered under the Umayyad Dynasty. These mosques have square or rectangular plans with an enclosed courtyard and covered prayer hall. Historically, in the warm Middle Eastern and Mediterranean climates, the courtyard served to accommodate the large number of worshippers during Friday prayers. Most early hypostyle mosques had flat roofs on prayer halls, which required the use of numerous columns and supports. One of the most notable hypostyle mosques is the Great Mosque of Cordoba in Spain, the building being supported by over 850 columns. Frequently, hypostyle mosques have outer arcades so that visitors can enjoy the shade. Arab-plan mosques were constructed mostly under the Umayyad and Abbasid dynasties; subsequently, however, the simplicity of the Arab plan limited the opportunities for further development, the mosques consequently losing popularity.
The first departure within mosque design started in Persia (Iran). The Persians had inherited a rich architectural legacy from the earlier Persian dynasties, and they began incorporating elements from earlier Parthian and Sassanid designs into their mosques, influenced by buildings such as the Palace of Ardashir and the Sarvestan Palace. Thus, Islamic architecture witnessed the introduction of such structures as domes and large, arched entrances, referred to as iwans. During Seljuq rule, as Islamic mysticism was on the rise, the four-iwan arrangement took form. The four-iwan format, finalized by the Seljuqs, and later inherited by the Safavids, firmly established the courtyard façade of such mosques, with the towering gateways at every side, as more important than the actual buildings themselves. They typically took the form of a square-shaped central courtyard with large entrances at each side, giving the impression of gateways to the spiritual world. The Persians also introduced Persian gardens into mosque designs. Soon, a distinctly Persian style of mosques started appearing that would significantly influence the designs of later Timurid, and also Mughal, mosque designs.
The Ottomans introduced central dome mosques in the 15th century. These mosques have a large dome centered over the prayer hall. In addition to having a large central dome, a common feature is smaller domes that exist off-center over the prayer hall or throughout the rest of the mosque, where prayer is not performed. This style was heavily influenced by Byzantine architecture with its use of large central domes. Hajja Soad’s mosque took a pyramid shape that is a creative style in Islamic architecture.
The Faisal Mosque in Islamabad, Pakistan, in a relatively unusual design fuses contemporary lines with the more traditional look of an Arab Bedouin’s tent, with its large triangular prayer hall and four minarets. However, unlike traditional mosque design, it lacks a dome. The mosque’s architecture is a departure from the long history of South Asian Islamic architecture.
Mosques built in Southeast Asia often represent the Indonesian-Javanese style architecture, which are different from the ones found throughout the Greater Middle East. The ones found in Europe and North America appear to have various styles but most are built on Western architectural designs, some are former churches or other buildings that were used by non-Muslims. In Africa, most mosques are old but the new ones are built in imitation of those of the Middle East. This can be seen in the Abuja National Mosque in Nigeria and others.
A common feature in mosques is the minaret, the tall, slender tower that usually is situated at one of the corners of the mosque structure. The top of the minaret is always the highest point in mosques that have one, and often the highest point in the immediate area. The tallest minaret in the world is located at the Hassan II Mosque in Casablanca, Morocco. It has a height of 210 metres (689 ft) and completed in 1993, it was designed by Michel Pinseau. The first mosques had no minarets, and even nowadays the most conservative Islamic movements, like Wahhabis, avoid building minarets, seeing them as ostentatious and hazardous in case of collapse.[dubious – discuss]The first minaret was constructed in 665 in Basra during the reign of the Umayyad caliph Muawiyah I. Muawiyah encouraged the construction of minarets, as they were supposed to bring mosques on par with Christian churches with their bell towers. Consequently, mosque architects borrowed the shape of the bell tower for their minarets, which were used for essentially the same purpose—calling the faithful to prayer. The oldest standing minaret in the world is the minaret of the Great Mosque of Kairouan in Tunisia, built between the 8th and the 9th century, it is a massive square tower consisting of three superimposed tiers of gradual size and decor.
Before the five required daily prayers, a Mu’adhdhin (Arabic: مُـؤَذِّن) calls the worshippers to prayer from the minaret. In many countries like Singapore where Muslims are not the majority, mosques are prohibited from loudly broadcasting the Adhān (Arabic: أَذَان, Call to Prayer), although it is supposed to be said loudly to the surrounding community. The adhan is required before every prayer. However, nearly every mosque assigns a muezzin for each prayer to say the adhan as it is a recommended practice or Sunnah (Arabic: سُـنَّـة) of the Islamic prophet Muhammad. At mosques that do not have minarets, the adhan is called instead from inside the mosque or somewhere else on the ground. The Iqâmah (Arabic: إِقَـامَـة), which is similar to the adhan and said immediately before the start of prayer, is usually not said from the minaret even if a mosque has one.
A miḥrāb (Arabic: مِـحْـرَاب), also spelled as mehrab is a semicircular niche in the wall of a mosque that indicates the qiblah (Arabic: قِـبْـلَـة, the direction of the Kaaba) in Mecca, and hence the direction that Muslims should face when praying. The wall in which a mihrab appears is thus the “qibla wall.” Mihrabs should not be confused with the minbar (Arabic: مِـنـۢبَـر), which is the raised platform from which an Imam (leader of prayer) addresses the congregation.
The domes, often placed directly above the main prayer hall, may signify the vaults of the heaven and sky. As time progressed, domes grew, from occupying a small part of the roof near the mihrab to encompassing the whole roof above the prayer hall. Although domes normally took on the shape of a hemisphere, the Mughals in India popularized onion-shaped domes in South Asia which has gone on to become characteristic of the Arabic architectural style of dome. Some mosques have multiple, often smaller, domes in addition to the main large dome that resides at the center.
The prayer hall, also known as the muṣallá (Arabic: مُـصَـلَّى), rarely has furniture; chairs and pews are generally absent from the prayer hall so as to allow as many worshipers as possible to line the room. Some mosques have Islamic calligraphy and Quranic verses on the walls to assist worshippers in focusing on the beauty of Islam and its holiest book, the Quran, as well as for decoration.
Often, a limited part of the prayer hall is sanctified formally as a masjid in the sharia sense (although the term masjid is also used for the larger mosque complex as well). Once designated, there are onerous limitations on the use of this formally designated masjid, and it may not be used for any purpose other than worship; restrictions that do not necessarily apply to the rest of the prayer area, and to the rest of the mosque complex (although such uses may be restricted by the conditions of the waqf that owns the mosque).
In many mosques, especially the early congregational mosques, the prayer hall is in the hypostyle form (the roof held up by a multitude of columns). One of the finest examples of the hypostyle-plan mosques is the Great Mosque of Kairouan (also known as the Mosque of Uqba) in Tunisia.
Usually opposite the entrance to the prayer hall is the qiblah wall, the visually emphasized area inside the prayer hall. The qiblah wall should, in a properly oriented mosque, be set perpendicular to a line leading to Mecca, the location of the Kaaba. Congregants pray in rows parallel to the qiblah wall and thus arrange themselves so they face Mecca. In the qiblah wall, usually at its center, is the mihrab, a niche or depression indicating the direction of Mecca. Usually the mihrab is not occupied by furniture either. Sometimes, especially during Friday prayers, a raised minbar or pulpit is located to the side of the mihrab for a Khaṭīb (Arabic: خَـطِـيـب), or some other speaker to offer a Khuṭbah (Arabic: خُـطْـبَـة, Sermon). The mihrab serves as the location where the imam leads the five daily prayers on a regular basis.
As ritual purification precedes all prayers, mosques often have ablution fountains or other facilities for washing in their entryways or courtyards. However, worshippers at much smaller mosques often have to use restrooms to perform their ablutions. In traditional mosques, this function is often elaborated into a freestanding building in the center of a courtyard. This desire for cleanliness extends to the prayer halls where shoes are disallowed to be worn anywhere other than the cloakroom. Thus, foyers with shelves to put shoes and racks to hold coats are commonplace among mosques.
Modern mosques have a variety of amenities available to their congregants. As mosques are supposed to appeal to the community, they may also have additional facilities, from health clinics to libraries to gymnasiums, to serve the community.
Certain symbols are represented in a mosque’s architecture to allude to different aspects of the Islamic religion. One of these feature symbols is the spiral. The “cosmic spiral” found in designs and on minarets is a references to heaven as it has “no beginning and no end”. Mosques also often have floral patterns or images of fruit and vegetables. These are allusions to the paradise after death.
Rules and etiquette
Mosques, in accordance with Islamic practices, institute a number of rules intended to keep Muslims focused on worshiping God. While there are several rules, such as those regarding not allowing shoes in the prayer hall, that are universal, there are many other rules that are dealt with and enforced in a variety of ways from mosque to mosque.
Appointment of a prayer leader is considered desirable, but not always obligatory. The permanent prayer leader (imam) must be a free honest individual and is authoritative in religious matters. In mosques constructed and maintained by the government, the prayer leader is appointed by the ruler; in private mosques, however, appointment is made by members of the congregation through majority voting. According to the Hanafi school of Islamic jurisprudence, the individual who built the mosque has a stronger claim to the title of imam, but this view is not shared by the other schools.
Leadership at prayer falls into three categories, depending on the type of prayer: five daily prayers, Friday prayer, or optional prayers. According to the Hanafi and Maliki school of Islamic jurisprudence, appointment of a prayer leader for Friday service is mandatory because otherwise the prayer is invalid. The Shafi’i and Hanbali schools, however, argue that the appointment is not necessary and the prayer is valid as long as it is performed in a congregation. A slave may lead a Friday prayer, but Muslim authorities disagree over whether the job can be done by a minor. An imam appointed to lead Friday prayers may also lead at the five daily prayers; Muslim scholars agree to the leader appointed for five daily services may lead the Friday service as well.
All Muslim authorities hold the consensus opinion that only men may lead prayer for men. Nevertheless, women prayer leaders are allowed to lead prayer in front of all-female congregations.
All mosques have rules regarding cleanliness, as it is an essential part of the worshippers’ experience. Muslims before prayer are required to cleanse themselves in an ablution process known as wudu. However, even to those who enter the prayer hall of a mosque without the intention of praying, there are still rules that apply. Shoes must not be worn inside the carpeted prayer hall. Some mosques will also extend that rule to include other parts of the facility even if those other locations are not devoted to prayer. Congregants and visitors to mosques are supposed to be clean themselves. It is also undesirable to come to the mosque after eating something that smells, such as garlic.
Islam requires that its adherents wear clothes that portray modesty. Men are supposed to come to the mosque wearing loose and clean clothes that do not reveal the shape of the body. Likewise, it is recommended that women at a mosque wear loose clothing that covers to the wrists and ankles, and cover their heads with a Ḥijāb (Arabic: حِـجَـاب), or other covering. Many Muslims, regardless of their ethnic background, wear Middle Eastern clothing associated with Arabic Islam to special occasions and prayers at mosques.
As mosques are places of worship, those within the mosque are required to remain respectful to those in prayer. Loud talking within the mosque, as well as discussion of topics deemed disrespectful, is forbidden in areas where people are praying. In addition, it is disrespectful to walk in front of or otherwise disturb Muslims in prayer. The walls within the mosque have few items, except for possibly Islamic calligraphy, so Muslims in prayer are not distracted. Muslims are also discouraged from wearing clothing with distracting images and symbols so as not to divert the attention of those standing behind them during prayer. In many mosques, even the carpeted prayer area has no designs, its plainness helping worshippers to focus.
There is nothing written in the Qurʼan about the issue of space in mosques and gender separation. However, traditional rules have segregated women and men. By traditional rules, women are most often told to occupy the rows behind the men. In part, this was a practical matter as the traditional posture for prayer – kneeling on the floor, head to the ground – made mixed-gender prayer uncomfortably revealing for many women and distracting for some men. Traditionalists try to argue that Muhammad preferred women to pray at home rather than at a mosque, and they cite a ḥadīth (Arabic: حَـدِيـث) in which Muhammad supposedly said: “The best mosques for women are the inner parts of their houses,” although women were active participants in the mosque started by Muhammad. Muhammad told Muslims not to forbid women from entering mosques. They are allowed to go in. The second Sunni caliph ʻUmar at one time prohibited women from attending mosques especially at night because he feared they may be sexually harassed or assaulted by men, so he required them to pray at home. Sometimes a special part of the mosque was railed off for women; for example, the governor of Mecca in 870 had ropes tied between the columns to make a separate place for women.
Many mosques today will put the women behind a barrier or partition or in another room. Mosques in South and Southeast Asia put men and women in separate rooms, as the divisions were built into them centuries ago. In nearly two-thirds of American mosques, women pray behind partitions or in separate areas, not in the main prayer hall; some mosques do not admit women at all due to the lack of space and the fact that some prayers, such as the Friday Jumuʻah, are mandatory for men but optional for women. Although there are sections exclusively for women and children, the Grand Mosque in Mecca is desegregated.
Non-Muslims in mosques
Under most interpretations of sharia, non-Muslims are permitted to enter mosques provided that they respect the place and the people inside it. A dissenting opinion and minority view is presented by followers of the Maliki school of Islamic jurisprudence, who argue that non-Muslims may not be allowed into mosques under any circumstances.
The Quran addresses the subject of non-Muslims, and particularly polytheists, in mosques in two verses in its ninth chapter, Sura At-Tawba.
According to Ahmad ibn Hanbal, these verses were followed to the letter at the times of Muhammad, when Jews and Christians, considered monotheists, were still allowed to the Masjid al-Haram. However, the Umayyad caliph Umar II later forbade non-Muslims from entering mosques, and his ruling remains in practice in present-day Saudi Arabia. Today, the decision on whether non-Muslims should be allowed to enter mosques varies. With few exceptions, mosques in the Arabian Peninsula as well as Morocco do not allow entry to non-Muslims. For example, the Hassan II Mosque in Casablanca is one of only two mosques in Morocco currently open to non-Muslims.
In modern-day Saudi Arabia, the Grand Mosque and all of Mecca are open only to Muslims. Likewise, the Al-Masjid al-Nabawi and the city of Medina that surrounds it are also off-limits to those who do not practice Islam. For mosques in other areas, it has most commonly been taken that non-Muslims may only enter mosques if granted permission to do so by Muslims and if they have a legitimate reason. All entrants regardless of religious affiliation are expected to respect the rules and decorum for mosques.
In certain times and places, non-Muslims were expected to behave a certain way in the vicinity of a mosque: in some Moroccan cities, Jews were required to remove their shoes when passing by a mosque; in 18th-century Egypt, Jews and Christians had to dismount before several mosques in veneration of their sanctity.
The association of the mosque with education remained one of its main characteristics throughout history, and the school became an indispensable appendage to the mosque. From the earliest days of Islam, the mosque was the center of the Muslim community, a place for prayer, meditation, religious instruction, political discussion, and a school. Anywhere Islam took hold, mosques were established; and basic religious and educational instruction began.
Source From Wikipedia