Matsya () was a Vedic kingdom and later became a part of sixteen Mahajanapadas, which also appears in Hindu Epic literature. The capital of Matsya was at Viratanagari (present-day Bairat, in Rajasthan) which is said to have been named after its founder king, Virata. The name Matsya itself means "fish."
Matsya was a prominent ancient Indian janapada (i.e., kingdom or state) located in the Madhyadesa (central zone). According to the Manusmriti, its territory was situated within the geographical limits of Brahmarsidesa. According to the Mahabharata, Matsya was located to the southwest of Indraprastha and west of the Surasena kingdoms. The ancient text Kasyapa Samhita mentions the Matsya janapada along with Dasarna and Surasena.
Historically, the Matsya Kingdom is identified with the modern territory of Jaipur, encompassing the entirety of the present-day region of Alwar and a portion of Bharatpur. Its capital city was known as Vairata or Viratanagara, which corresponds to the modern town of Bairat, Rajasthan. Another city mentioned as a possible capital is Upaplavya or Upaplava, located at a two-day chariot journey distance from Hastinapura. Due to its location along major routes of conquest and travel, few ancient remains of the Virata province are preserved.
Matsya kingdom was founded by king Matsya who was the twin brother of Satyavati and who was contemporary to Bhishma. Within the Mahabharata, the Matsya kingdom is most referenced within the Virata Parva book.
The Matsya Kingdom plays a crucial role in the Mahabharata as the refuge chosen by the Pandava brothers and Draupadi for the thirteenth year of exile, known as the year of concealment, following twelve years of dwelling in the forest. The Pandavas, after travelling to Matsya and presenting themselves as hunters, concealed their weapons in the hollow of a sami tree, hanging a decomposing corpse above the spot to deter people. Yudhisthira, the eldest Pandava, chose Matsya after Arjuna suggested several names. The deity Dharma had previously granted Yudhisthira the boon ensuring that the Pandavas would not be recognized during this thirteenth year.
While living in Matsya, the Pandavas adopted specific disguises and assumed new identities:
The Pandavas were able to dwell in the city hidden from view, sustaining themselves though their different occupations. Bhisma is cited in the Mahabharata as stating that wherever Yudhisthira resides, even in disguise, the land is certain to be rich and bountiful, and the cattle will thrive.
King Virata, the ruler of Matsya, was noted for his substantial cattle wealth, leading to him being described as a "cattle baron." The theft of this wealth by the Kauravas (i.e., a cattle raide) became an object of the Virata Parva narrative, necessitating the disguised Arjuna's intervention.
Following the successful completion of the period of concealment and the revelation of the Pandavas' identities, King Virata offered his daughter, Uttara, along with his entire kingdom, to Arjuna. Arjuna declined Uttara as a wife but accepted her as a daughter-in-law, arranging her marriage to his son Abhimanyu. This marriage forged a crucial political alliance between Matsya and the Bharata clan. Uttara is destined to become the mother of Pariksit, who would perpetuate Arjuna's race.
The Matsya people are counted among ancient communities, alongside the Taksakas and Karkotakas, that had a direct relationship with the Nagas in Rajasthan. The capital city, Bairat, and the names Virata and Matsya are considered to have Naga affinity. This lineage is also suggested by the origin story of the Matsyas in the Mahabharata whose eponymous king Matsya and his twin sister Satyavati were said to have had fisherman backgrounds.