Agnipariksha of Sita was done to demonstrate the purity and faithfulness of Sita towards Rama. After the defeat and death of Ravana and after Vibhishana was made the king of Lanka, Rama asked Hanuman to go and find out Sita and to give her the news about the triumph of Rama over Ravana. Hanuman found Sita still under the guard of the rakshasis and sitting under the Ashoka tree. After Hanuman gave her the message of Rama, Sita urged to see her Lord and Hanuman thus conveyed the message to Rama. Then Rama told Vibhishana to bring Sita before him properly bathed and adorned with jewels and sandal paste. After Sita was brought before Rama, then the son of Dasaratha told her that he had wiped out the insult to his family and himself but she stained herself by staying in another person`s abode and therefore he would like to renounce her and asked her to choose to live either with Lakshmana or Vibhishana or Sugriva.
Sita, after hearing the cruel speech of Rama, trembled like a swaying vine, and wept with heavy tears, and she was ashamed before that great assembly. However, she wiped out the tears from her face and told Rama that her self was sufficient enough to prove her purity. Then she turned towards Lakshmana and told that with such an insult she would not wish to live in this world and asked him to prepare a funeral pyre for her. Then Lakshmana turned towards Rama and finding him silent, he prepared the funeral pyre.
Then Sita, circumabulating Rama, standing with downcast eyes, approached the fire with folded hands she stood and prayed to the fire god. She prayed to the fire god that if she be pure and if her thought had never been influenced anyone other that Rama then she should be guarded. Then Sita went about the pyre and entered the burning flames, so that all, both young and old, assembled there were overcome with grief, and the noise of uttermost wailing and lamentation arose on every hand.
Rama stayed immovable and rapt; but the gods came down to Lanka in their shining cars and, folding their hands, prayed Rama to relent. The gods prayed to Rama that he was the protector of the world and how could he leave his wife Sita to death in the fire. They told Rama that he was the first of all the gods and was the creator and he should not denounce Sita in such a fashion. To the urge of all the gods Rama replied that he only a man, Rama, the son of Dasaratha and wanted the grand-sire to tell him who he was and from where he came to this world. Then Lord Brahma told him that he was none other that the Lord Vishnu himself and knew the past, the present and the future. He then told that Sita was none other than Lakshmi and he was Vishnu and also Lord Krishna.
The God of Fire after hearing the those happy words, rose up with Sita on his lap, radiant as the morning sun, with golden jewels and black curling hair, and he gave her back to Rama. He told to Rama that Sita was not touched by a single stain. Neither in word, nor in thought or look was Sita turned aside from Rama. However, she was tempted every way, she did not think of Ravana even in her inmost heart. As she was spotless, the Fire god urged Rama to take her back. Rama, stayed silent for a while, and with shining eyes pondered the speech of Agni and told that since Sita lived for a long time in the house of Ravana, she needed vindication before the assembled folk. If he had taken he unproved, the people would have complain that Rama, the son of King Dasaratha, was moved by desire, and set aside the social law. However, Rama told that he knew very well that Sita`s heart was pure, and that her virtue was her sufficient refuge from the assaults of the demon Ravana. Thus, Rama regained his bride, and his heart was glad.