Dilīpa in Hindu mythology is said to have been one of the most righteous and chivalrous emperors that the Solar Dynasty or the Ikshvaku dynasty, had ever produced. He was childless for a long time. In the matter of begetting an heir, he took the advice of Vasishta. The sage divined his condition and told him that, once on the way back to earth after fighting a war on the side of the gods, Dilipa failed to notice the divine cow Kamadhenu on his way and passed without paying his respects to her. Thereby he incurred the anger of the cow, who cursed the king to go childless. To negate the ill-effects of the curse, the king was advised to worship the divine cow Nandini who was the daughter of Kamadhenu, and thereby to earn her goodwill.
The king faithfully served Nandini for twenty-one days. He slept where the cow slept, ate when the cow ate and washed the cow and took very good care of it. On the twenty-second day, when the cow was grazing in the field, a lion appeared suddenly and pounced to eat Nandini. The king tried to kill the lion but could not, because the lion happened to be a servant of Lord Shiva and he cast a spell on King Dileepa that made him motionless. The king wanted to protect the cow but could not do anything but speak. He begged the lion to spare the cow and eat him instead and bowed before the lion.
Seeing that the king was willing to sacrifice himself to save her, the cow was very much pleased. She revealed that the incident was actually a trick which she had played on the king to test his faithfulness. Nandini removed the curse of her mother and the King very soon begat a son, who came to be called as Raghu meaning one who was learned in the shastras and who vanquished the enemies in war.
Dilipa was a very pious king known to be by his another name as Khatwanga, and performed as many as 100 yajnas. Until he did so, only Indra, king of the gods, had earned that distinction. In a bid to prevent Dileepa from equalling his record, Indra placed many hurdles in the path of the successful completion of the 100th yajna, but Raghu, son of Dilipa, was able to prevail over the forces of Indra, and the yajna was completed successfully.
Dileep was a good king, he had already knew that the lion was sent by lord shiva.