The NIlamata Purana (नीलमत पुराण) is an ancient text (6th to 8th century AD) from Kashmir which contains information on its history, geography, religion, and folklore. It was used by Kalhana as one of sources of his history. The dating of the text is based on the following reasoning: "The textual study of the work shows that some alterations and additions have been made in it after the ninth or tenth century A.D. in order to incorporate into it the monistic Saiva Philosophy of Kasmira. Had the Nilamata been composed after the ninth century A.D. there would have been no scope for such change. The lower limit of the date thus may be eighth century A. D. and the upper one about the sixth century A.D. as Buddha began to be regarded as an incarnation of Visnu from about 550 A.D."
According to the historian Ved Kumari: "If the Rajatarangini is important from the point of view of the political history of 'Kasmira', the Nilamata is no less important for the cultural history of that part of the country." Its critical edition was published in 1924. It is the national epic of Kashmir along with Rajatarangini encompassing modern day regions of modern day India, Pakistan Afghanistan, Khorasan, Tajikistan, Modern Dardic regions of world.
The Nilamata opens with Janamejaya's enquiry from Vaisampayana as to why the king of Kashmir did not participate in the war of Mababharata although his kingdom was not less important than any other in the country. Vaisampayana states that some time before the Mababharata war was fought, king Gonanda of Kashmir had been invited by his relative Jarasandha to help him in a war against the yadavas. Gonanda complied with his request and was slain on the battle field by Lord Krishna's brother, Balarama. In order to avenge his father's death, Gonanda's son Damodara went to Gandhara to fight with lord Krishna who had gone there to attend a Svayamvara. Krishna killed Damodara in the fight but taking into consideration the high sanctity of Kashmir he coronated his rival's pregnant widow Yasovati. Damodara's Posthumous son Bala Gonanda was a minor at the time of the great war, so he did not join either the Kauravas or the Pandavas. Vaismpayana points out the importance of Kashmir by referring to its numerous charms and its identification with Uma. He points out further that the valley was originally a lake known as Satisaras. This leads to the question about the origin of 'Kashmir' to which Vaisanipayana replies by relating a dialogue held previously between Gonanda and the sage Brahadasva.