Every mosque attempts to be modelled on the first mosque built and directed by Muhammad in Medina.
The functions of a mosque cannot be understood without considering the first mosque and its role and rule in the first Muslim community.
When Muhammad emigrated from Mecca to Medina — now known as Hijra which has an enormous spiritual and political significance in Islam — the majority of its inhabitants were not Muslims. It had a large Jewish population, both proselytised Arabs, Jews and Christians, and a large majority of pagan Arabs.