The Jataka, Vol. II, tr. by W.H.D. Rouse, , at sacred-texts.com
 "Why do yore patiently," etc. This story the Master told at Jetavana, about a certain impertinent monkey. At Sāvatthi, we are told, was a tame monkey in a certain family; and it ran into the elephant's stable, and perching on the back of a virtuous elephant, voided excrement, and began to walk up and down. The elephant, being both virtuous and patient, did nothing. But one day in this elephant's place stood a wicked young one. The monkey thought it was the same, and climbed upon its back. The elephant seized him in his trunk, and dashing him to the ground, trod him to pieces. This became known in the meeting of the Brotherhood; and one day they. all began to talk about it. "Brother, have you heard how the impertinent monkey mistook a had elephant for a good one, and climbed on his back, and how he lost his life for it?" In came the Master, and asked, "Brethren, what are you talking of as you sit here?" and when they told him, "This is not the first time," said he, "that this impertinent monkey behaved so; he did the same before:" and he told them an old-world tale.
Once on a time, when Brahmadatta was king of Behaves, the Bodhisatta was born in the Himalaya region as a Buffalo. He grew up strong and
big, and ranged the hills and mountains, peaks and caves, tortuous woods a many.
Once, as he went, he saw a pleasant tree, and took his food, standing under it.
Then an impertinent monkey came down out of the tree, and getting on his back, voided excrement; then he took hold of one of the Buffalo's horns, and swung down from it by his tail, disporting himself. The Bodhisatta, being full of patience, kindliness, and mercy, took no notice at all of his misconduct. This the monkey did again and again.
But one day, the spirit that belonged to that tree, standing upon the tree-trunk, asked him, saying,  "My lord Buffalo, why do you put up with the rudeness of this bad Monkey? Put a stop to him!" and enlarging upon this theme he repeated the first two verses as follows:
"Crush underfoot, transfix him with your horn!
Stop him or even children will show scorn."
The Bodhisatta, on hearing this, replied, "If, Tree-sprite, I cannot endure this monkey's ill-treatment without abusing his birth, lineage, and powers, how can my wish ever come to fulfilment? But the monkey will do the same to any other, thinking him to be like me. And if he does it to any fierce Buffalos, they will destroy him indeed. When some other has killed him, I shall be delivered both from pain and from blood-guiltiness." And saying this he repeated the third verse:
A few days after, the Bodhisatta went elsewhither, and another Buffalo, a savage beast, went and stood in his place. The wicked Monkey,  thinking it to be the old one, climbed upon his back and did as before. The Buffalo shook him off upon the ground, and drove his horn into the Monkey's heart, and trampled him to mincemeat under his hoofs..
When the Master had ended this teaching, he declared the Truths, and identified the Birth: "At that time the bad buffalo was he who now is the bad elephant, the bad monkey was the same, but the virtuous noble Buffalo was I myself."
262:1 Jātaka Mālā, no. 33 (Mahisa); Cariyā-Piṭaka, II. 5.