The Jataka, Vol. II, tr. by W.H.D. Rouse, , at sacred-texts.com
"When all alone," etc. This story the Master told whilst living at Jetavana, about the gift of a thousand garments, how the reverend Ānanda received five hundred garments from the women of the household of the king of Kosala, and five hundred from the king himself. The circumstances have been described above, in the Sigāla Birth, of the Second Book 2.
Once on a time, while Brahmadatta was king of Benares, the Bodhisatta was born as the son of a brahmin in Kāsi. On his nameday they called him Master Tirīṭavaceha. In due time he grew up, and studied at Takkasilā. He married and settled down, but his parents' death so distressed him  that he became an ascetic, and lived in a woodland dwelling, feeding upon the roots and fruits of the forest.
Whilst he lived there, arose a disturbance on the frontiers of Benares. The king repaired thither, but was worsted in the fight; fearing for his life, he mounted an elephant, and fled away covertly through the forest. In the morning, Tirīṭavaceha had gone abroad to gather wild fruit, and meanwhile the king came upon his hut. "A hermit's hut!" quoth he; down he came from his elephant, weary with wind and sun, and athirst; he looked about for a waterpot, but none could he find. At the end of the covered walk he spied a well, but he could see no rope and bucket for the drawing of water. His thirst was too great to bear; he took off the girth which passed under the elephant's belly, made it fast on the edge, and let himself down into the well. But it was too short; so he tied on to the end of it his lower garment, and let himself down again. Still he could not reach the water. He could just touch it with his feet: he was very thirsty! "If I can but quench my thirst," thought he, "death itself will be sweet!" So down he dropped, and drank his fill; but he could not get up again, so he remained standing there in the well. And the elephant, so well trained was he, stood still, waiting for the king.
In the evening, the Bodhisatta returned, laden with wild fruits, and espied the elephant. "I suppose," thought he, "the king is come; but nothing is to be seen save the armed elephant. What's to do?" And he approached the elephant, which stood and waited for him. He went to the edge of the well, and saw the king at the bottom. "Fear nothing, O king!" he called out; then he placed a ladder, and helped the king out; he chafed the king's body, and anointed him with oil; after which he gave him of the fruits to eat , and loosed the elephant's armour. Two or three days the king rested there; then he went away, after making the Bodhisatta promise to pay him a visit.
The royal forces were encamped hard by the city; and when the king was perceived coming, they flocked around him.
After a month and half a month, the Bodhisatta returned to Benares, and settled in the park. Next day he came to the palace to ask for food. The king had opened a great window, and stood looking out into the courtyard; and so seeing the Bodhisatta, and recognising him, he descended and gave him greeting; he led him to a dais, and set him upon the throne under a white umbrella; his own food the king gave him to eat, and ate himself of it. Then he took him to the garden, and caused a covered walk and a dwelling to be made for him, and furnished him with all the necessaries of an ascetic; then giving him in charge of a gardener, he bade farewell, and departed. After this, the Bodhisatta took his food in the king's dwelling: great was the respect and honour paid to him.
But the courtiers could not endure it. "If a soldier," said they, "were to receive such honour, how would he behave!" They betook
them to the viceroy: "My lord, our king is making too much of an ascetic! What can he have seen in the man? You speak with the king about it." The viceroy consented, and they all went together before the king. And the viceroy greeted the king, and uttered the first stanza:
 The king listened. Then he said, addressing his son,
"My son, you remember how once I went to the marches, and how I was conquered in war, and came not back for a few days?"
"I remember," said be.
"This man saved my life," said the king; and he told him all that had happened. "Well, my son, now that this my preserver is with me, I cannot requite him for what he has done, not even were I to give him my kingdom." And he recited the two stanzas following:--
"By his sole doing I returned again
Out of death's jaws back to the world of men.
To recompense such kindness is but fair;
Give a rich offering, nor stint his share."
 So spake the king, as though he were causing the moon to rise up in the sky; and as the virtue of the Bodhisatta was declared, so was declared his own virtue everywhere; and his takings increased, and the honour shown to him. After that neither his viceroy nor his courtiers nor any one else durst say anything against him to the king. The king abode in the Bodhisatta's admonition; and he gave alms and did good, and at the last went to swell the hosts of heaven. And the Bodhisatta, having cultivated the Perfections and the Attainments, became destined to the world of Brahma.
Then the Master added, "Wise men of old gave help too;" and having thus concluded his discourse, he identified the Birth as follows: "Ānanda was the king, and I was the hermit."
218:2 No. 152, page 4, where however there is no word of this incident; it really occurs in No. 156, p. 17 of this volume.
220:1 To hang his waterpot upon.