Islam is India's second-largest religion, with 14.2% of the country's population, approximately 172.2 million people identifying as adherents of Islam in 2011 Census. India is also the country with the third-largest number of Muslims in the world. The majority of India's Muslims are Sunni, with Shia making up 13% of the Muslim population. Islam spread in Indian communities along the Arab coastal trade routes in Gujarat and along the Malabar Coast shortly after the religion emerged in the Arabian Peninsula. Islam arrived in the inland of Indian subcontinent in the 7th century when the Arabs conquered Sindh and later arrived in Punjab and North India in the 12th century via the Ghaznavids and Ghurids conquest and has since become a part of India's religious and cultural heritage. The Barwada Mosque in Ghogha, Gujarat built before 623 CE, Cheraman Juma Mosque (629 CE) in Methala, Kerala and Palaiya Jumma Palli (or The Old Jumma Masjid, 628–630 CE) in Kilakarai, Tamil Nadu are three of the first mosques in India which were built by seafaring Arab merchants. According to the Legend of Cheraman Perumals, the first Indian mosque was built in 624 CE at Kodungallur in present-day Kerala with the mandate of the last ruler (the Cheraman Perumal) of the Chera dynasty, who converted to Islam during the lifetime of Muhammad (c. 570–632). Similarly, Tamil Muslims on the eastern coasts also claim that they converted to Islam in Muhammad's lifetime. The local mosques date to the early 700s. History Origins The vast majority of the Muslims in India belong to South Asian ethnic groups. However, some Indian Muslims were found with detectable, traceable, minor to some levels of gene flow from outside, primarily from the Middle East and Central Asia. However, they are found in very low levels. Sources indicate that the castes among Muslims developed as the result of the concept of Kafa'a. Those who are referred to as Ashrafs (see also Sharif) are presumed to have a superior status derived from their foreign Arab ancestry, while the Ajlafs are assumed to be converts from Hinduism, and have a lower status. Many of these ulema also believed that it is best to marry within one own caste. The practice of endogamous marriage in one's caste is strictly observed in India. In two of the three genetic studies referenced here, in which is described that samples were taken from several regions of