The Jataka, Vol. III, tr. by H.T. Francis and R.A. Neil, , at sacred-texts.com
"Why in mid air," etc.—This story the Master, while dwelling at Jetavana, told concerning the duty of doing good to men. The incident that led to the story will be set forth in the Mahākaṇha Birth. 3
Once upon a time when Brahmadatta was reigning in Benares, the Bodhisatta came to life as the son of his chief queen. And when he was of age, he was instructed in all the arts and on the death of his father was established in his kingdom and governed it righteously.
At that time men were devoted to the worship of the gods  and made religious offerings to them by the slaughter of many goats, rams and the like. The Bodhisatta proclaimed by beat of drum, "No living creature is to be put to death." The Yakkhas were enraged against the Bodhisatta at losing their offerings, and calling together an assembly of their kind in the Himalayās, they sent forth a certain savage Yakkha to slay the Bodhisatta. He took a huge blazing mass of iron as big as the dome of a
house, and thinking to strike a deadly blow, immediately after the mid watch, came and stood at the bed's head of the Bodhisatta. At that instant the throne of Sakka manifested signs of heat. After considering the matter the god discovered the cause, and grasping his thunderbolt in his hand he came and stood over the Yakkha. The Bodhisatta on seeing the Yakkha thought, "Why in the world is he standing here? Is it to protect me, or from a desire to slay me?" And as he talked with him he repeated the first stanza:
With yon huge bolt of iron in thy hand?
Art thou to guard me from all harm intent,
Or here to-day for my destruction sent?
Now the Bodhisatta saw only the Yakkha. He did not see Sakka. The Yakkha through fear of Sakka durst not strike the Bodhisatta. On hearing the words of the Bodhisatta the Yakkha said, "Great king, I am not stationed here to guard you; I came minded to smite you with this blazing mass of iron, but through fear of Sakka I dare not strike you." And to explain his meaning he uttered the second stanza:
To compass thy destruction I appear,
But all in vain the fiery bolt I wield
Against the head that Indra's self would shield.
On hearing this the Bodhisatta repeated two more stanzas:
Great king of gods, my cause to champion deigns,
 With hideous howl though goblins rend the sky,
No demon brood has power to terrify.
Let mud-sprite devils gibber as they may,
They are not equal to so stern a fray.
Thus did Sakka put the Yakkha to flight. And exhorting the Great Being, he said, "Great king, fear not. Henceforth we will protect you. Be not afraid." And so saying he returned straight to his own place of abode.
The Master here ended his lesson and identified the Birth: "At that time Anuruddha was Sakka, and I myself was the king of Benares."
96:1 See no. 405.
96:2 See R. Morris, Folk-Lore Journal, iii. 336.
96:3 No. 469, Vol. iv.