The Bodhisatta was once an ascetic, named Mudulakkhana, of great spiritual attainments, living in the Himālaya. On one occasion he came to Benares where the king, pleased with his demeanour, invited him to the palace and persuaded him to live in the royal park. Sixteen years passed, and the king, leaving the city to quell a border rising, left his wife in the care of the ascetic. The next day the ascetic visited the palace, and having seen the queen, fell instantly in love with her, losing all his iddhi powers. When the king returned he found the ascetic disconsolate, and, on learning the reason, agreed to give him the queen. But he secretly asked the queen, whose name was Mudulakkhanā, to think of some device by which she might save the ascetic's holiness. Together the ascetic and the queen left the palace and went to a house which the king had given them and which was generally used as a jakes. The queen made the ascetic clean the house and fetch water and do one hundred other things. The ascetic then realized his folly and hastened back to the king, surrendering the queen.
The story was related to a young man of rich family belonging to Sāvatthi, who became a monk and practiced meditation. One day, while going for alms, he saw a beautiful woman and was seized with desire. He thereupon gave up his practices, and was brought before the Buddha, who told him this story, at the conclusion of which he became an arahant.
Ananda was the king and Uppalavannā the queen. J.i.302-6.