The climactic books of the Ramayana of Valmiki describe the war between Rama and Ravana, the demon king of Lanka who had abducted Rama's wife Sita while Rama and his brother Lakshmana were drawn away from their forest hermitage by a trick involving a golden deer. Rama, allied with the monkey king Sugriva, whom he had helped restore to his throne, and Sugriva's devoted general Hanuman, led an army of vanaras, monkey warriors, across a bridge built to the island kingdom of Lanka to rescue Sita and confront Ravana.
The war culminates in single combat between Rama and Ravana, described at length across the epic's Yuddha Kanda, in which Rama, using a weapon empowered by the sage Agastya, finally kills Ravana after the demon king's many heads and arms prove otherwise nearly impossible to permanently destroy. Following the victory, Sita undergoes a trial by fire, Agni Pariksha, to prove her purity after her captivity, an episode the epic presents as vindicating her but that has drawn extensive later commentary and, in some retellings, revision.
The episode is presented throughout the Ramayana as the decisive triumph of dharma, righteous cosmic order, over the adharma Ravana's pride and abduction of Sita represented, fulfilling the purpose for which Vishnu had incarnated as Rama in the first place.