legends of these communities, the earliest Christian churches, mosque, and synagogue (CE 1568) in India were built in Kerala. The combined number of Jews, Muslims, and Christians was relatively small at this early stage. They co-existed harmoniously with each other and with local Hindu society, aided by the commercial benefit from such association. Medieval and Early Modern periods Political changes Much of history of the region from the 6th to the 8th century is obscure. From the Kodungallur line of the Cheras rose the Kulasekhara dynasty, which was established by Kulasekhara Varman. At its zenith these Later Cheras ruled over a territory comprising the whole of modern Kerala and a smaller part of modern Tamil Nadu. During the early part of Kulasekhara period, the southern region from Nagercoil to Thiruvananthapuram was ruled by Ay kings, who lost their power in the 10th century and thus the region became a part of the Cheras. Kerala witnessed a flourishing period of art, literature, trade and the Bhakti movement of Hinduism. A Keralite identity, distinct from the Tamils, became linguistically separate during this period. The origin of Malayalam calendar dates back to year 825 CE. For the local administration, the empire was divided into provinces under the rule of Nair Chieftains known as Naduvazhis, with each province comprising a number of Desams under the control of chieftains, called as Desavazhis. The era witnessed also a shift in political power, as Namboothiri Brahmins established the caste hierarchy in Kerala by assigning different groups separate positions. As a result, many temples were constructed across Kerala, which according to M. T. Narayanan "became cornerstones of the socio-economic society". Mamankam festival, which was the largest native festival, was held at Tirunavaya near Kuttippuram, on the bank of river Bharathappuzha. Athavanad, the headquarters of Azhvanchery Thamprakkal, who were also considered as the supreme religious chief of the Nambudiri Brahmins of Kerala, is also located near Tirunavaya. Sulaiman al-Tajir, a Persian merchant who visited Kerala during the reign of Sthanu Ravi Varma (9th century CE), records that there was extensive trade between Kerala and China at that time, based at the port of Kollam. A number of foreign accounts have mentioned about the presence of considerable Muslim population in the coastal towns. Arab writers such as Al-Masudi of Baghdad (896–956 CE), Muhammad al-Idrisi (1100–1165 CE), Abulfeda (1273–1331 CE), and Al-Dimashqi (1256–1327 CE) mention the Muslim communities in Kerala. Some