Panthalayini, and Chaliyam, were built during the era of Malik Dinar, and they are among the oldest Masjids in the Indian subcontinent. It is believed that Malik Dinar died at Thalangara in Kasaragod town. Sometime between the fourth and eighth century, the Knanaya Community is believed to have arrived from the Middle East under the leadership of the Syrian merchant Thomas of Cana. The community settled on the southern side of Cranganore and eventually established three churches in the names of St. Thomas, St. Kuriakose, and St. Mary. The Knanaya left their settlement after its destruction during a battle between the Kingdom of Cochin and Zamorin of Calicut in the 16th century. According to one tradition, a Cochin Jew colony in Malabar Coast, probably established before the sixth century BCE, attracted the Apostle to this region. Medieval port of Kodungallur The economic and political prestige of the harbour of Kodungallur remained even in medieval South India. Sulaiman, a West Asian visitor to India during this period, recorded the "economic prosperity" of the region. Also, he describes the Chinese traders in the city; they are described as purchasing articles such as spices (pepper and cinnamon), ivory, pearls, cotton fabrics and teak wood. The port was sacked by the Chola rulers in the 11th century CE. After the dissolution of the Chera Perumal rule (early 12th century CE), Kodungallur emerged as a principality, named Padinjattedathu Swaroopam, under the control of the royal family of Kodungallur Kovilakam. The city state was "allied" either to the kingdom of Cochin (Kochi) or to Calicut (Kozhikode). It is postulated that the harbour at Kodungallur was devastated by natural calamities—a flood or an earthquake—in 1341, and consequently lost its commercial/strategic importance thereafter. Consequently, the trade got diverted to other ports of the Malabar Coast, such as Cochin (Kochi) and Calicut (Kozhikode). It is speculated that the floods split the left branch of the River Periyar into two, just before the town of Aluva. The flood silted the right branch (known as the River Changala) and the natural harbour at the mouth of the river to make it poorly navigable for large vessels. Portuguese era Portuguese navigators began operating in South India from the early 16th century CE. During this period, Kodungallur was a "tributary state" of the kingdom of Kozhikode (Calicut) of Zamorins (Samoothiris). Since Kodungallur was sandwiched between the kingdom of Kozhikode and the kingdom of