Lord Vishnu was incarnated as Sri Rama to eliminate Ravana. This story is mentioned in Padma Purana’s Pathala Khanda.
People of Ayodhya lived peacefully during Sri Rama’s reign until one fateful day when they were struck by a bad news–Sri Rama had abandoned Sita after a Washerman leveled an unfair charge against her character. Such was the greatness of Sri Rama that opinion of each and every individual was given due respect irrespective of his position and status. One day, Sage Agastya arrived in the royal court of Sri Rama. After the formal Salutations were over. Sage Agastya complimented Sri Rama for killing Ravana.
Sri Rama asked Agastya–‘Who was Ravana– the tormentor of deities? I am anxious to know about the origin of his whole clan.”
Sage Agastya replied–Vishrava was the grandson of Lord Brahma. His father was sage Pulastya. Vishrava had two wives–Mandakini and Kaikasi. Mandakani’s son was Kubera while Kaikasi was the mother of Ravana, Kumbhakarna and Vibhishana. Kubera ruled over Lanka. One day, Kubera, came to see his parents boarded on his aircraft–Pushpak Vimana. After he returned to Lanka, Ravana, who was very much impressed by Kubera’s royal appearances, asked Kaikasi–“Who was this fellow? From where did he acquire such an amazing aircraft?”
Kaikasi revealed to Ravana that the guest was none other than his step-brother Kubera. She said–“Kubera is the son of your step mother–Mandakini. He has made his mother proud by his conduct but I am ashamed of you, because of your inconsequential existence. You are no better than a worm.”
Ravana decided to prove his mother wrong by acquiring insurmountable power and authority. Ravana went to the forest and performed an austere penance for ten thousand years by standing on one foot. He fixed his gaze at the sun and never for a moment did he remove his gaze from it. Kumbhakarna and Vibhishan also engaged themselves in austere penance. At last, Lord Brahma became pleased and blessed Ravana with a vast kingdom. Ravana then started tormenting his step-brother Kumbhakarna. He snatched Kubera’s Pushpak Vimana and drove him out of Lanka. Ravana then turned his attention towards the deities and drove them out of heaven. The deities went to seek the help of Lord Brahma who in turn took them to Lord Shiva. Even Lord Shiva was clueless about the means by which the indomitable Ravana could be subdued. Ultimately all of them including Lord Shiva went to Lord Vishnu and sought his help.
Lord Vishnu assured them by saying —
“I shall take incarnation as Rama at a place called Ayodhya. Presently, Ayodhya is being ruled by Dashrath, who inspite of having three queens, does not have any son. I shall manifest myself as Rama. Don’t worry! I shall eliminate the menace called Ravana.” Sage Agastya also told Sri Rama that Ravana belonged to the caste called ‘Brahmrakshas’. This way, Sage Agastya after having finished his narration looked at Sri Rama anticipating further queries.