The Bodhisatta was once an ascetic who lived alone in the Himalayas, eating fruits and roots. One time he went down to a city to get seasoning and salt and he slept in the royal park. The next morning the king saw the Bodhisatta out collecting alms and, impressed by his demeanor, invited him into the palace for a big meal. After they talked, the king invited the Bodhisatta to remain in the city and live permanently in his park. The Bodhisatta accepted the offer and stayed there, being fed and cared for by the king, for twelve years.
When the king needed to go put down an uprising in the border region, his queen promised to look after the Bodhisatta. One morning the Bodhisatta was late departing to the palace for his meal, so he flew through the air and when the queen heard him arrive at the window she hastily rose to greet him and her robe slipped off. The Bodhisatta saw her naked and was overcome by the sight; his heart filled with lust and his insight vanished. He took his food back to his hut, walking there because he could no longer fly, and remained alone for seven days, continuing to burn with lust.
When the king returned he went to visit the Bodhisatta. He saw rotting food covered with flies and was worried that he had taken ill. When the Bodhisatta said he was wounded the king assumed his enemies had come to do him harm, so he rolled the Bodhisatta over looking for the injury. But the Bodhisatta said he was not wounded by an archer, he had wounded his own heart and explained what had happened. Then the Bodhisatta sent the king away and induced a mystic trance, curing himself of his lust and restoring his insight and ecstasy. He gave a last sermon to the king and returned to the Himalayas.
In the Lifetime of the Buddha
One of the Buddha’s disciples, while out on a morning alms round, saw a woman so beautiful he fell in love at first sight. He no longer took joy in his studies or meditation and became so depressed he stopped cleaning himself. The Buddha told him this story to remind him that controlling natural passions is difficult and takes great effort, even for highly purified people.
The king was an earlier births of Ananda, one of the Buddha’s top disciples.