The term masjid literally means a place of prostration. The masjid was the formal space established for the collective performance of prayer and ritual, and for meeting the social needs of the ummah (community).
Most historians agree that in the early days of Islam (i.e. in early 7th century Mecca) the original Muslim community had no specific or special place of prayer and the arrangements for communal worship were informal. It is only after the hijra (migration) to Medina, that a specific space emerged and evolved, where Muslims could collectively perform ritual prayers together as well as manage the affairs of the state. Subsequently, wherever the Muslim community became permanently established in large numbers, the mosque became a focal point for their religious and social life.
In these new Muslim lands, there were attempts initially to reproduce, in both design and function, the first masjid of Medina. However, as the Muslim empire spread across geography, it came in contact with different cultures and traditions. In addition, internal factors, such as the increasing availability of wealth and patronage, influx of new converts, the diversity in notions of piety, and the corresponding needs of the communities of users, collectively contributed to a rapid change and evolution in mosque design and usage.