Malappuram is one of the 14 districts in the South Indian state of Kerala. The district has a unique and eventful history starting from pre-historic times. During the early medieval period, the district was the home to two of the four major kingdoms that ruled Kerala. Perumpadappu was the original hometown of the Kingdom of Cochin, which is also known as Perumbadappu Swaroopam, and Nediyiruppu was the original hometown of the Zamorin of Calicut, which is also known as Nediyiruppu Swaroopam. Besides, the original headquarters of the Palakkad Rajas were also at Athavanad in the district.

Ancient period

The remains of some pre-historic symbols including Dolmens, Menhirs, and Rock-cut caves have been found from various parts of the district. Rock-cut caves have been found from the places like Puliyakkode, Thrikkulam, Oorakam, Melmuri, Ponmala, Vallikunnu, and Vengara. The ancient maritime port of Tyndis, which was a centre of trade with Ancient Rome, is roughly identified with Ponnani, Tanur, and Vallikkunnu-Kadalundi-Chaliyam-Beypore region. Tyndis was a major center of trade, next only to Muziris, between the Cheras and the Roman Empire.Coastal Histories: Society and Ecology in Pre-modern India, Yogesh Sharma, Primus Books 2010 Pliny the Elder (1st century CE) states that the port of Tyndis was located at the northwestern border of Keprobotos (Chera dynasty).Gurukkal, R., & Whittaker, D. (2001). In search of Muziris. Journal of Roman Archaeology, 14, 334-350. The North Malabar region, which lies north of the port at Tyndis, was ruled by the kingdom of Ezhimala during Sangam period.A. Shreedhara Menon, A Survey of Kerala History According to the Periplus of the Erythraean Sea, a region known as Limyrike began at Naura and Tyndis. However the Ptolemy mentions only Tyndis as the Limyrike'''s starting point. The region probably ended at Kanyakumari; it thus roughly corresponds to the present-day Malabar Coast. The value of Rome's annual trade with the region was estimated at around 50,000,000 sesterces.According to Pliny the Elder, goods from India were sold in the Empire at 100 times their original purchase price. See Pliny the Elder mentioned that Limyrike was prone by pirates.Bostock, John (1855). "26 (Voyages to India)". Pliny the Elder, The Natural History. London: Taylor and Francis. The Cosmas Indicopleustes mentioned that the Limyrike was a source of peppers.Indicopleustes, Cosmas (1897). Christian Topography. 11. United Kingdom: The Tertullian Project. pp. 358–373. Das, Santosh Kumar (2006). The Economic History of Ancient India. Genesis Publishing Pvt Ltd. p. 301. The River Bharathappuzha (River Ponnani) had importance since Sangam period (1st-4th century CE), due to the presence of Palakkad Gap which connected the Malabar coast with Coromandel coast through inland.

Early medieval period

The Kurumathur inscription found near Areekode dates back to 871 CE.Veluthat, Kesavan (1 June 2018). "History and historiography in constituting a region: The case of Kerala". Studies in People's History. 5 (1): 13–31. Three Old Malayalam inscriptions those date back to 932 CE, those were found from Triprangode (near Tirunavaya), Kottakkal, and Chaliyar, mention the name of Goda Ravi of Chera dynasty.Narayanan, M. G. S. Perumals of Kerala: Brahmin Oligarchy and Ritual Monarchy Perumāḷs of Kerala. Thrissur (Kerala): CosmoBooks, 2013. 438-42. The Triprangode inscription states about the agreement of Thavanur. Several inscriptions written in Old Malayalam those date back to 10th century CE, have found from Sukapuram near Edappal, which was one of the 64 old Nambudiri villages of Kerala. Descriptions about the rulers of Eranad region and Valluvanad region can be seen in Jewish copper plates of Bhaskara Ravi Varman and Viraraghava copper plates of Veera Raghava Chakravarthy. A number of city-states were there in the region, including Valluvanad, Vettathunadu (Tanur), Parappanad and Nediyiruppu (Eranad) (ruled by the Zamorins). Rise of the Zamorin of Calicut

During and around the fall of Perumal Empire, Calicut and its environs were ruled over by Porlathiri. Eranad was ruled by a Samanthan Nair clan known as Eradis, similar to the Vellodis of neighbouring Valluvanad and Nedungadis of Nedunganad. The rulers of Eranad were known by the title Eralppad/Eradi. The Eradis (A title used to denote the rulers of Eranad) of Nediyiruppu marched with their army to Panniyankara and often surrounded the headquarters of Porlathiri. The ultimate aim was to find access to the sea and thus to participate directly in the maritime trade. This war lasted for almost half a century. The battle ended in the victory of the Eradis. Porlathiri fled to Kolathunadu in search of political asylum.

With the conquest of Polanad, the Eradis who ruled Eranad shifted their headquarters from Nediyiruppu to Calicut, and later began to known as the Zamorin of Calicut. In the early stage of his territorial development, Zamorin expanded his territories to Parappanad and Vettathunad by defeating their rulers.

The power balance in Kerala changed as Eralnadu rulers developed the port at Kozhikode. The Samoothiri became one of the most powerful chiefs in Kerala. In some of his military campaigns – such as that into Valluvanadu – the ruler received unambiguous assistance from the Muslim Middle Eastern sailors.V. V., Haridas. "King court and culture in medieval Kerala – The Zamorins of Calicut (AD 1200 to AD 1767)". Unpublished PhD Thesis. Mangalore University It seems that the Muslim judge of Kozhikode offered all help in "money and material" to the Samoothiri to strike at Thirunavaya. Smaller chiefdoms south of Kozhikode – Beypore, Chaliyam, Parappanadu and Tanur (Vettam) – soon had to submit and became their feudatories one by one.

The ruler of Kozhikode next turned his attention to the valley of Bharathappuzha. Large parts of the valley were then ruled by Valluvakkonathiri, the hereditary chief of Valluvanadu. The principal objective of Kozhikode was the capture the sacred settlement of Thirunavaya. The rivalry that existed between the Nambudiris in the Nambudiri villages of Panniyoor and Chowwara (Sukapuram) was also of great political importance in medieval Kerala. Panniyoor is situated opposite to Kuttippuram town while Sukapuram lies in Edappal. Soon the Samoothiris found themselves intervened in the so-called kurmatsaram between Nambudiris of Panniyurkur and Chovvarakur. In the most recent event, the Nambudiris from Thirumanasseri Nadu had assaulted and burned the nearby rival village. The rulers of Valluvanadu and Perumpadappu came to help the Chovvaram and raided Panniyur simultaneously. Thirumanasseri Nadu was overran by its neighbours on south and east. The Thirumanasseri Nambudiri appealed to the ruler of Kozhikode for help, and promised to cede the port of Ponnani to Kozhikode as the price for his protection. Kozhikode, looking for such an opportunity, gladly accepted the offer.

Assisted by the warriors of their subordinate chiefs (Chaliyam, Beypore, Tanur and Kodungallur) and the Muslim naval fleet under the Koya of Kozhikode, the Samoothiri's fighters advanced by both land and sea. The main force under the command of Samoothiri himself attacked, encamping at Triprangode, an allied force of Valluvanadu and Perumpadappu from the north. Meanwhile, another force under the Eralppadu commanded a fleet across the sea and landed at Ponnani and later moved to Thirumanasseri, with an intention to descend on Thirunavaya from the south with help of the warriors of the Thirumanasseri Brahmins. Eralppadu also prevented the warriors of Perumpadappu from joining Valluvanadu forces. The Muslim merchants and commanders at Ponnani supported the Kozhikode force with food, transport, and provisions. The warriors of the Eralppadu moved north and crossed the Bharathappuzha and took up position on the northern side of the river. The Koya marched at the head of a large column and stormed Tirunavaya. In spite of the fact that the warriors of Valluvanadu did not get the timely help of Perumpadappu, they fought vigorously and the battle dragged on. In the meantime, the Kozhikode minister Mangattachan was also successful in turning Kadannamanna Elavakayil Vellodi (junior branch of Kadannamanna) to their side. Finally, two Valluvanadu princes were killed in the battles, the Nairs abandoned the settlement and Kozhikode infested Tirunavaya.

The capture of Thirunavaya was not the end of Kozhikode's expansion into Valluvanadu. The Samoothiri continued surges over on Valluvanadu. Malappuram, Nilambur, Vallappanattukara and Manjeri were easily occupied. He encountered stiff resistance in some places and the fights went on in a protracted and sporadic fashion for a long time. Further assaults in the east against Valluvanadu were neither prolonged nor difficult for Kozhikode.

The battles along the western borders of Valluvanadu were bitter, for they were marked by treachery and crime. Panthalur and Ten Kalams came under Kozhikode only after a protracted struggle. The assassination of a minister of Kozhikode by the chief minister of Valluvanadu while visiting Kottakkal in Valluvanadu sparked the battle, which dragged on for almost a decade. At last, the Valluvanadu minister was captured by Samoothiri's warriors and executed at Padapparambu, and his province (Ten Kalams, including Kottakkal and Panthalur) was occupied by the Samoothiri. The Kizhakke Kovilakam Munalappadu, who took a leading part in this campaign, received half of the newly captured province from Samoothiri as a gift. The loss of this fiercely loyal chief minister was the greatest blow to Valluvanadu after the loss of Tirunavaya and Ponnani.

The port of Ponnani was a prominent centre of Islamic learning and Tirunavaya was a centre of Vedic learning in medieval Kerala. The ports of Ponnani, Tanur and Parappanangadi had some of the oldest Muslim settlements in Kerala originated as a result of the trade relationship.

Late medieval period Thrikkavil Kovilakam in Ponnani served as a second home for Zamorin, and his navy headquarters.K. V. Krishna Iyer Zamorins of Calicut: From the Earliest Times to AD 1806. Calicut: Norman Printing Bureau, 1938 Archaeological relics found in Malappuram include the remnants of palaces of the eastern branch of the Zamorin reign. Malappuram was the military headquarters of the Zamorin in the Eranad region. The Zamorins held sway over Malappuram and their chieftain Para Nambi, ruled the area in the early days with headquarters at Downhill (Kottappadi), Malappuram. Zamorin earned a greater part of his revenue by taxing the spice trade through his ports. Smaller ports in kingdom included Parappanangadi, Tanur, and Ponnani.K. V. Krishna Iyer, Zamorins of Calicut: From the earliest times to AD 1806. Calicut: Norman Printing Bureau, 1938.Kunhali. V. "Calicut in History" Publication Division, University of Calicut (Kerala), 2004 The headquarters of the Azhvanchery Thamprakkal, who were considered as the supreme religious head of Kerala Brahmins, was at Athavanad. Besides, the original headquarters of the Palakkad Rajas were also at Athavanad.