Madurai is a major tier II city in the state of Tamil Nadu, India. It is the administrative headquarters of the Madurai District and is a Hindu pilgrimage centre. The recorded history of Madurai extends to about 2000 years, and in that time, it has become a major economic, religious and cultural centre.

Madurai was first inhabited by modern humans in the early Holocene, around 10000 years ago. Several tools and artifacts belonging to the Paleolithic and the Mesolithic, point towards a hunter-gatherer culture in the area, which appears to have been sparsely populated. Madurai's recorded history began around 2500 years ago, and the area has evolved into a major settlement over the centuries. It served as the seat of the Early Pandyas, and is mentioned in the Cilappatikaram and other works of the Sangam literature. Madurai is also described by Greek and Roman scholars of the period. After the Kalabhras defeated the Pandyas, they subsequently occupied Madurai.

In the late 6th century CE, the city was conquered by the later Pandyas. The city was later ruled by the Imperial Cholas, with the Pandyas as their subordinates. Successively, Madurai became the capital of the Imperial Pandyas, and under their rule, the city's economy underwent advancement. In the early 14th century CE, Madurai was invaded by Malik Kafur, and then multiple times consecutively by the Delhi Sultanate. Civil wars broke out between the Pandyas too, and the city was devastated by the invasions and riots. Later, rebelling factions of the Delhi Sultanate established the Madurai Sultanate, centred around the city.

Then, Madurai was conquered by the Vijayanagara Empire under Kumara Kampana, who actuated renovations of the city. The Vijayanagara rulers appointed the Nayakas as the governors of the city. In a transient period of rule, the Nayakas declared their independence, and established Madurai as their capital. The city was expanded and renovated by the Nayaks. After a relatively brief period of rule under the Carnatic Nawab (aided by the East India Company, against the French East India Company), Madurai was officially ceded to the British East India Company in 1801 CE. Madurai later came under the rule of the British Raj, which developed the economy and expanded the city. After the independence of India in 1947 CE, Madurai came under the Madras state, and later under the state of Tamil Nadu. Madurai was, as of 2011, the third largest metropolis in Tamil Nadu, and is a major centre of industry, education, culture, and religion.

Prehistory

Early Holocene Madurai and its vicinity has been inhabited by Homo sapiens since the Upper Paleolithic and the Mesolithic period. Quartzite tools belonging to the Upper Paleolithic period were found in the banks of the Vaigai, immediately north to the old town of Madurai, by the British archaeologist Robert Bruce Foote. Other sites to the south of Madurai have been dated to the Mesolithic period. Megaliths, dolmens, and menhirs dated to the Neolithic are found in Manamadurai and Perumal Malai, all of them in the vicinity of Madurai.

In the upper Gundar basin, around 20 km southwest to Madurai, 109 Microlithic sites have been identified. Located near Tirumangalam and Usilampatti, these exhibit clear signs of Mesolithic habitation. Blades, hammerstones, chips, flakes and other lithic artifacts dated to the Mesolithic have been collected, and the stone toolkit of these peoples indicates the use of microlithic technology.

The environment around Madurai was in contrast with the present-day conditions. Humid conditions prevailed in the area during the early Holocene, and the semi-arid conditions of the present gradually came into being in the middle Holocene. The fauna included many Mesolithic wild animals; bones representing the Nilgiri tahr and the Zebu were found. Flora represented in the records include the Dioscorea yams and the Acacia caesia (Eenkai). The hunter-gatherer groups of the period had movement and foraging strategies similar in some ways to that of the Paliyans, who presently inhabit the area.

The Neolithic sites show development in technology; these people exhibit the use of macrolithic technology. Ringstones (or maceheads), made of gneiss and perforated with bores are also found, dating to the Neolithic. Hammerstones, buried urns, and megalithic tombs of this period are also found.

Iron age (1000 BCE - 300 BCE) The Iron age in the region is marked by a shift towards iron technology; numerous iron swords, iron frames, and other tools and artifacts were found at sites surrounding Madurai. Potsherds, bowls, jars and black and red pottery collected at these sites show signs of gradual urbanization. Bones exhibiting signs of butchering and charring, were also discovered, along with bones of sheep and goats. Wootz steel, a kind of high carbon crucible steel, was also developed around this period, due to refinement in steel production methods.

Early historic period (600 BCE - 300 CE)

The recorded history of Madurai is roughly dated to the 3rd century BCE. The Sangam period settlement site of Keeladi, dating back to the 6th century BCE, is located about 12 kilometres southeast of Madurai. Inscriptions of the Pandya king Netunceliyan I (c. 2nd century BCE) are found in Mangulam, a village located 25 kilometres from Madurai.

The Greek explorer Megasthenes may have visited Madurai during the 3rd century BCE; the city was mentioned as "Methora" in his accounts. The view is contested by some scholars who believe "Methora" refers to the north Indian city of Mathura, as it was an established city in the Mauryan Empire. Megasthenes reports an oral tradition of a deity venerated in "Methora", which, according to some scholars, serves as an early precursor to the legend of Meenakshi as Madurai's tutelary deity. The story begins with a male deity, whose only daughter was given an army, and a territory to rule. Her name, reports Megasthenes, was "Pandia", which she got from her kingdom's name. The god himself finally married her, unable to find a suitable spouse for her. The Pandyas did exist during this time, as evidenced by Ashoka's Major Rock Edict No., 2, so it is possible that Megasthenes did refer to Madurai. Madurai is also mentioned in Kautilya's (370–283 BCE) political treatise Arthashastra. Madurai is described in the Sri Lankan chronicle Mahavamsa, as "Madura", ruled by a Pandya contemporary of Prince Vijaya. Madurai is mentioned in the works of Roman historians Pliny the Younger (61 – c. 112 CE), Ptolemy (c. 90 – 168 CE), those of the Greek geographer Strabo (64/63 BCE – c. 24 CE), and in the Periplus of the Erythraean Sea. The country of the Pandyas was described as Pandya Mediterranea (the Pandyan inland) by Ptolemy, and the Pandyas themselves were mentioned as Modura Regia Pandionis (the Madurai-ruling Pandyans). The second book of the Tamil epic Silappatikaram (c. 5th century CE) is set in Madurai. Maturaikkāñci, another Sangam work dated to the 3rd century CE, describes the social life of people in ancient Madurai under the Pandyas, and in the broader Tamil realm. Further, the Sangam work Kalittokai refers to Madurai as "Koodal", "Mādakoodal", and as "Nānmādakoodal", and mentions the Vaigai bordering the northern rampart walls of the city. Another Sangam work, the Paripāṭal, describes Madurai (referring to the city as Koodal) and the Vaigai (referring to the river as Vaiyai) too. Many festivals were celebrated in Madurai, including the festival of Margali, during the Tiruvādhirai asterism.

Madurai in the Cilappatikaram The Cilappatikaram describes Madurai, its environment and the lifestyle of its people. When approaching from the north (i.e., Uraiyur), Madurai is said to be located to the left of Sirumalai, near Tirumalkunram (Alagar Koil). Madurai is described as a busy city, with "smoke rising from kitchens and the broad bazaar where cooks fried cakes in pans, and the smoke of sacrificial offerings, along with the scent of flowers growing on the banks of Vaigai, including jasmine, creating a fragrant atmosphere". The city is described as surrounded by a moat, with flags set upon the city-fortress of Madurai. It had narrow passages leading from the moat into the fortress defended by Yavana soldiers; in its bazaar were:

The tutelary goddess of Madurai, as described by the Cilappatikaram, was Madurāpati, who seems to have been another precursor to Meenakshi. Some attributes of the latter have been noted to be similar to that of Madurāpati, including a golden lotus in her hand, and her position as the family deity of Pandyas. The Kallalagar Temple is referenced in the Cilappatikaram, as the abode of Tirumal (Vishnu).

Maturaikkanchi The Maturaikkanci describes a well-structured administration in Madurai. Madurai is described as the capital city of the Pandyas, with fortified gates, and towers over them, a deep moat, a high rampart, two crowded bazaars, broad streets, mansions and markets. The city's gateways were high enough to allow elephants to pass through them, and the residences of the people had pillared halls and decorated walls. Stucco images and statues were also set on the walls. The king had a palace. In its courtyard, musk deer and swan were kept. The walls were plastered and decorated with mural paintings of flowers and ornamental designs. The king had ministers, officials and judges.

Patrolmen and soldiers watched the streets, collected tolls and protected the traders from theft. The city had many temples; families carried offerings to the gods in these temples, and inside these temples were musicians playing various styles of music, according to the Maturaikkanci.

People of various cultures and languages lived in the city, and people belonging to the same occupation resided together. Various flags were hoisted in the city, and musical instruments such as the parai were used to herald information and to make announcements. The city was busy with a great influx of artisans and traders. Madurai is described to have been active throughout the night too, with markets operating actively as during the daytime. The people wore either embroidered garments of silk, or cotton clothes. They wore necklaces of pearls, bangles of seashells, gem-set gold rings, flower garlands and anklets. They wore flowing garments, flowers on their tufts of hair, ornate headdresses, and anklets with inlaid pearls and gemstones.

Madurai in the Paripāṭal Seventeen poems of the Paripātal are dedicated to the Vaigai, and 4 others are dedicated to Madurai. The Paripātal talks of the people of Madurai enjoying themselves in the banks of the Vaigai, and engaging in water sports in the river. It describes the Pandya king resorting to the river too. The city of Madurai is described by the deployment of a simile as follows:

The poem, comparing Madurai to the lotus blossoming from the navel of Vishnu, has imparted a cosmogonic symbolism to the city, according to Holly Baker Reynolds. The Paripāṭal also describes the city to be "greater" than the rest of the world, in poetic significance:

The work then describes the lifestyle of the city's people, who are mentioned to have spent their leisure, and to have offered prayers on the banks of the Vaigai. People raced in the river using simple rafts, and lovers united on the riverbank. Some women dropped figurines of crabs and fishes as offerings into the river. Sevvel (Murugan) and Māyōn (Vishnu) are referred to as the primary deities, with songs composed in praise of them. The Pandyan army is described to be like the floods in the Vaigai, "uncontrollably rushing forward". People are described to have lived in separate quarters, and are said to have worn flower garlands, ornamental chains and headdresses.

Kalabhra dynasty (300–590 CE)