The Ramayana

This very long and complex epic, in which many stories are interwoven and a multitude of great teachings is given, is traditionally ascribed to the Maharishi Valmiki.
The various stories contain quite contradictory messages, depending on your understanding you can come to widely differing conclusions.
The main plot of the Ramayana, which is often cited as the complete story, follows the usual Hollywood scheme. There is a hero, Rama, and a heroine, Sita. They have to face all kinds of hardship and to defeat various evil forces. The main villain, king Ravana steals the hero's wife, Sita. Rama gathers his friends and sets out to destroy the villain's empire. He kills Ravana and his allies and is reunited with Sita. The good guys win and the bad guys are killed: happy ending.
The reason why the whole drama has to take place is revealed to Vasishtha in the beginning of the story:
At one time all the gods went together to appeal to the Supreme God Vishnu, who is the preserver amongst the three major gods of the Hindu trinity, for his help. They explained, “The ten-headed Ravana and his brothers have acquired from us extraordinary powers through austerities and prayers, and now threaten to destroy our worlds and enslave us. They go along recklessly in their career of tyranny, suppressing all virtue and goodness wherever found. Shiva is unable to help; Brahma the Creator can do very little, since the powers that Ravana and his brothers are now misusing were originally conferred by these two gods, and cannot be withdrawn by them. You alone are the Protector and should save us.” Whereupon Vishnu promised, “Ravana can be destroyed only by a human being since he never asked for protection from a human being. I shall incarnate as Dasaratha’s son, and my conch and my wheel, which I hold in each hand for certain purposes, and my couch, namely Adisesha, the Serpent, on whose coils I rest, shall be born as my brothers, and all the gods here shall take birth in the world below in a monkey clan—since Ravana has been cursed in earlier times to expect his destruction only from a monkey.”

Ramayana
Lakshman, Ram, Sita and Hanuman (kneeling), the main protagonists of the Ramayana

However, in the Bhagavata Purana, another important ancient Hindu scripture, Vishnu has promised his devoted gatekeeper Jay instant liberation after three lifetimes in human form, if he agrees to play Vishnu’s fierce opponent in all three incarnations. The form of Ravana is the second incarnation of those three. During the events of the Ramayana this initial agreement naturally has to be forgotten by the key players and is kept in the dark for everybody else, because, if the other participants had found out that Rama and Ravana are just playacting, the original divine intention would be lost.
Furthermore the story of the Ramayana has also been included in Jain mythology, where the three key players Rama, Lakshman (Rama’s brother) and Ravana are seen as Shalaka Purushas, “illustrious or worthy persons” who are influencing the human evolution, but only if they act as an archetypical triad of gentle hero, warrior hero and anti-hero. Even though the anti-hero is revered a little less than the other two, all three types are worshipped and seen as important and interdependent roles in the unfolding of events.
So actually we have very contradictory messages in the Ramayana depending on the version you're looking at. If you only look at the core story, the conclusions are quite simple: Do as Rama does and do NOT do as Ravana does. For billions of Hindus this has been a valuable and practical guideline in life, and the values of the Ramayana have been the foundation for every Hindu society around the planet. Nothing wrong with that! There have been much fewer fights within the Hindu communities than within Muslim or Christian groups throughout the centuries. Those people, who are happy to live a life within the samsaric cycle (continuous cycle of life and death) will fare better in their lives if they follow the behavioral blueprints, which Rama, Sita and the other good characters in the story are embodying.

Ramayana_Fight
Rama kills Ravana in the final battle

If, however, you happen to be one of the few that are willing to see the bigger story, the whole value system falls apart and becomes irrelevant. For the seeker of liberation from the cycle of life and death there is no moral code. Ravana is often more convincing in the way he plays his role until the very end than Rama and his brother Lakshman, who are committing a lot of blunders and succeed in the end only with the help of their divine companion Hanuman.
In other words: for those, who desire a smooth life within society and in the worldly realms, it is advisable to follow certain legal or ethical codes and rules to avoid trouble and to be appreciated by your fellow humans. The advantage is that these rules and laws protect you from the violation of your rights by others and you can complain to the authorities of your society if your fellow human beings harm you or break the rules and laws. The disadvantage is that you will either have to compromise or accept punishment if you yourself are caught breaking the rules.

But for those, who seek liberation, it’s a whole different story. You might be chosen to be a villain in a divine drama and that may just be your path to awakening.

A beautiful modern film version by American artist Nina Paley: