A wizard was wont to come at midnight in order to corrupt the queen of Benares. She complained to the king and, at his request, she set the mark on her hand with vermillion on his back. By day the man was an ascetic, and when he found that he was discovered he fled through the air. The king thereupon suspected all ascetics and ordered them all to leave the kingdom. The king became a heretic. The Bodhisatta who was born as Sakka, seeing all this, came to Benares with an old Pacceka Buddha and stood close to the palace, showing him great reverence. When the king came out Sakka revealed his identity, telling him that even the ruler of the gods honoured pious men. The king saw his error and mended his ways.
The origin of the story is given in the Mahākanha Jātaka. The king is identified with Ananda. J.iii.303-7.
More or less the same story is given at greater length and with several variations in detail in both the Cullahamsa and the Mahāhamsa Jātakas.