Ikshvaku's son Nimi once decided to organise a Yagya that was to last for one thousand years. He also wanted the sage Vashishta to guide the Yagya. But Indra had already booked Vashishta for a period of five hundred years. So sage Vashishta expressed his inability to conduct any other Yagya till the completion of that period and requested the king to wait till he was free from Indra's obligations. Nimi kept quite at that time. Taking his silence as an approval, the sage began the Yagya for Indra. But the king meanwhile started Yagya in the auspices of other sages like Gautam etc.
At the completion of Yagya for Indra, sage Vashishta hurried back to the earth to conduct Yagya for King Nimi. But here he found that a Yagya was already in progression. This infuriated the sage to the extent that he poured down curse on Nimi, who was sleeping at that time, to lose his body at once. When the king learned about the curse and that he was cursed in sleep, he cursed the sage in retaliation to lose his body at once before giving up his own body. By the curse of Nimi, Vashishta's body was destroyed but he himself entered the semen of Mitra-Varuna. Thereafter, one day Mitra-Varuna happened to see the apsara Urvashi. Her amorous beauty caused the ejaculation of his semen spontaneously. With ejaculated semen, sage Vashishta also came out and acquired a new body.
On the other hand, at end of Yagya when the gods appeared to accept their due share from the offerings, the sages prayed them to grant Nimi some boon. Nimi however sought nothing in boon but expressed his desire to stay in eyes of the people forever. The gods granted that desire. Before that nobody had ever blinked his eyes. Blinking of eyes came into practice because Nimi stays there. In order to save the kingdom from anarchy, the sages churned the dead body of Nimi with a stick of Bombax tree and produced a son. That son came to known as Janaka. Since he was born from the dead body of his father, the boy also came to be known as Vaideha. Lineage of Janaka continued as follows: Janaka, Udavasu, Nandivardhan, Suketu, Devrat, Brihadukth, Mahaveerya, Sudhriti, Dhrishtketu, Haryashva, Manu, Prateet, Kritrath, Devbheed, Vibudh, Mahadhriti, Kritraj, Maharoma, Suvarnaroma, Hrasyaroma and Seerdhvaj. With a desire of a son, Seerdhvaj was once ploughing the earth when he stumbled upon a pitcher. In the pitcher, he found a beautiful baby whom he named as Sita.