The Jataka, Volume I, tr. by Robert Chalmers, , at sacred-texts.com
"If folk but knew."--This story was told by the Master while at Jetavana about Feasts for the Dead. For at this time the folk were putting to death goats, sheep, and other animals, and offering them up as what is called a Feast for the Dead, for the sake of their departed kinsmen. Finding them thus engaged, the Brethren asked the Master, saying, "Just now, sir, the folk are taking the lives of many living creatures and offering them up as what is called a Feast for the Dead. Can it be, sir, that there is any good in this?"
"No, Brethren" replied the Master; "not even when life is taken with the object of providing a Feast for the Dead, does any good arise therefrom. In bygone days the wise, preaching the Truth from mid-air, and shewing the evil consequences of the practice, made the whole continent renounce it. But now, when their previous existences have become confused in their minds, the practice has sprung up afresh." And, so saying, he told this story of the past.
Once on a time when Brahmadatta was reigning in Benares, a brahmin, Who was versed in the Three Vedas and world-famed as a teacher, being minded to offer a Feast for the Dead, had a goat fetched and said to his
pupils, "My sons, take this goat down to the river and bathe it; then hang a garland round its neck, give it a pottle of grain to eat, groom it a bit, and bring it back."
"Very good," said they, and down to the river they took the goat, where they bathed and groomed the creature and set it on the bank, The goat, becoming conscious of the deeds of its past lives, was overjoyed at the thought that on this very day it would be freed from all its misery, and laughed aloud like the smashing of a pot. Then at the thought that the brahmin by slaying it would bear the misery which it had borne, the goat felt a great compassion for the brahmin, and wept with a loud voice. "Friend goat," said the young brahmins , "your voice has been loud both in laughter and in weeping; what made you laugh and what made you weep?"
"Ask me your question before your master."
So with the goat they came to their master and told him of the matter. After hearing their story, the master asked the goat why it laughed and why it wept. Hereupon the animal, recalling its past deeds by its power of remembering its former existences, spoke thus to the brahmin:--"In times past, brahmin, I, like you, was a brahmin versed in the mystic texts of the Vedas, and I, to offer a Feast for the Dead, killed a goat for my offering. All through killing that single goat, I have had my head cut off five hundred times all but one. This is my five hundredth and last birth; and I laughed aloud when I thought that this very day I should be freed from my misery. On the other hand, I wept when I thought how, whilst I, who for killing a goat had been doomed to lose my head five hundred times, was to-day being freed from my misery, you, as a penalty for killing me, would be doomed to lose your head, like me, five hundred times. Thus it was out of compassion for you that I wept." "Fear not, goat," said the brahmin; "I will not kill you." "What is this you say, brahmin?" said the goat. "Whether you kill me or not, I cannot escape death to-day." "Fear not, goat; I will go about with you to guard you." "Weak is your protection, brahmin, and strong is the force of my evil-doing."
Setting the goat at liberty, the brahmin said to his disciples, "Let us not allow anyone to kill this goat;" and, accompanied by the young men, he followed the animal closely about. The moment the goat was set free, it reached out its neck to browse on the leaves of a bush growing near the top of a rock. And that very instant a thunderbolt struck the rock, rending off a mass which hit the goat on the outstretched neck and tore off its head. And people came crowding round.
 In those days the Bodhisatta had been born a Tree-Fairy in that selfsame spot. By his supernatural powers he now seated himself cross-legged in mid-air while all the crowd looked on. Thinking to himself. 'If
these creatures only knew the fruit of evil-doing, perhaps they would desist from killing,' in his sweet voice he taught them the Truth in this stanza:--
Thus did the Great Being preach the Truth, scaring his hearers with the fear of hell; and the people, hearing him, were so terrified at the fear of hell that they left off taking life. And the Bodhisatta after establishing the multitude in the Commandments by preaching the Truth to them, passed away to fare according to his deserts. The people, too, remained steadfast in the teaching of the Bodhisatta and spent their lives in charity and other good works, so that in the end they thronged the City of the Devas.
His lesson ended, the Master shewed the connexion, and identified the Birth by saying, "In those days I was the Tree-fairy."