Why Ramayana was written?
King Arishtanemi was performing intense austerities on the Gandhamardana Mountains. Indra sent his messenger to him to bring him to the heavens. The messenger informs Arishtanemi about the invitation for Indra. Arishtanemi has one question for the messenger and asks, "What is so great about heaven that I would like to settle there? The messenger replies that the rewards for merits are very high in heaven. However, when a person's merit is exhausted, they must return to the realm of the mortals.
Arishtanemi is unimpressed and sends back the messenger. Arishtanemi informs the messenger that his goal is liberation. The messenger returns with Indra's instructions to take Arishtanemi to Sage Valmiki. Only Valmiki can lead Arishtanemi to the goal he wants.
On meeting the sage Valmiki, Arishtanemi asks him, "O great sage! You are informed of all the ways and truths of virtue and know all the scriptures with certainty. I am in great doubt, and I pray you will kindly remove it. Tell me, in your opinion, whether liberation results from a man's acts, knowledge, or both?".
Valmiki replies, "Just like a bird flies with both wings, similarly for the highest state of emancipation, one needs to have both knowledge and action. Neither knowledge nor action alone can lead us to liberation. Valmiki says "I will recite to you the great tale of Shri Rama. By hearing and understanding his life you will find your liberation"
Arishtanemi asks “O best of sages, tell me exactly who and what this Rama was. What was his bondage and how did he become free of it?"
Valmiki replies, "Shri Hari Vishnu was cursed to take the form of a mortal with an assumed ignorance like that of men with little knowledge. This story is for the person who convinced that they are bound, who desires liberation, and who is neither wholly ignorant of nor quite conversant with divine knowledge."
Sanatkumara, who was devoid of desires, had been residing at the abode of Brahma, to which Vishnu,the lord of the three worlds, was a visitor. The lord god Vishnu was welcomed by all the inhabitants of the Brahmaloka as well as by Brahma himself, except by Sanatkumara. The god Vishnu addressed Sanatkumara, “Sanatkumara, it is ignorance that makes you forsake your desires for fear of rebirth, therefore you must be born under the name of Sara-janma to be troubled with desires.”
In return, Sanatkumara denounced Vishnu by saying, “Even as all discerning as you are, you shall have to sacrifice your omniscience for some time, and live as an ignorant mortal.”
There was another curse pronounced upon Vishnu by the sage Bhrigu who, seeing his wife killed by Vishnu, became incensed with anger and said, “Vishnu you shall have also to be deprived of your wife.” Again, when the pregnant wife of Devadatta was killed from fear on seeing the man-lion figure of Vishnu (Narasimha), the leonine Vishnu was denounced by the husband who was sorely afflicted at the loss of his wife.Thus cursed by Bhrigu, Sanatkumara & Devadatta, Vishnu was obliged to be born on this earth in the figure of a human being.
Aristameni asks how can hearing the story help in his liberation. Sage Valmiki replies "By hearing, you will become able to cast away the impurity of errors.You are wise and you have to manage yourself in the manner of the blissful and lotus-eyed Rama, with a mind free from worldly attachments.”
“It was by this means that Lakshman, Bharata, the great minded Satrughna, Kausalya, Sita, Sumitra, as well as Dasharata, with Vasishta and Vamadeva, and the eight ministers of state as well as many others reached the summit of knowledge. The eight ministers of Rama — Dhrishta, Jayanta, Bhasa, Satya, Vijaya, Vibishanah, Sushena and Hanumana, and also Indrajita — are said to have been equally dispassionate in their minds and content with what was their lot. They were great souls, free in their lives.”
“Well my son, if you follow the manner in which these men observed sacrificial rites, gave and received their offerings, and how they lived and thought, you are at once freed from the turmoil of life. One fallen in this boundless ocean of the world may enjoy the bliss of liberation by the
magnanimity of his soul. He shall not come across grief or destitution, but shall remain ever satisfied by being freed from the fever of anxiety."
The story of Shri Rama is for the liberation of the mortal world thats troubled by its miseries.