The Jataka, Volume I, tr. by Robert Chalmers, , at sacred-texts.com
"Lo! in your stronghold."--This story was told by the Master while at Jetavana, about a certain Brother who was given by the Master a subject for meditation, and, going to the borders, took up his abode in the forest near a hamlet. Here he hoped to pass the rainy season, but during the very first month his hut was burnt down whilst he was in the village seeking alms. Feeling the loss of its sheltering roof, he told his lay friends of his misfortune, and they readily undertook to build him another hut. But, in spite of their protestations, three months slipped away without its being rebuilt. Having no roof to shelter him, the Brother had no success in his meditation. Not even the dawn of the Light had been vouchsafed to him when at the close of the rainy season he went back to Jetavana and stood respectfully before the Master. In the course of talk the Master asked whether the Brother's meditation had been successful. Then that Brother related from the beginning the good and ill that had befallen him. Said the Master, "In days gone by, even brute beasts could discern between what was good and what bad for them and so quitted betimes, ere they proved dangerous, the habitations that had sheltered them in happier days. And if beasts were so discerning, how could you fall so far short of them in wisdom?" So saying, at that Brother's request, the Master told this story of the past.
Once on a time when Brahmadatta was reigning in Benares, the Bodhisatta was born a bird. When he came to years of discretion, good fortune attended him and he became king of the birds, taking up his abode with his subjects in a giant tree which stretched its leafy branches over the waters of a lake. And all these birds,  roosting in the boughs, dropped their dung into the waters below. Now that lake was the abode of Caṇḍa, the Naga King, who was enraged by this fouling of his water and resolved to take vengeance on the birds and burn them out. So one night when they were all roosting along the branches, he set to work, and first he made the waters of the lake to boil, then he caused smoke to arise, and thirdly he made flames dart up as high as a palm-tree.
Seeing the flames shooting up from the water, the Bodhisatta cried to the birds, "Water is used to quench fire; but here is the water itself on fire. This is no place for us; let us seek a home elsewhere." So saying, he uttered this stanza:--
And hereupon the Bodhisatta flew off with such of the birds as followed his advice; but the disobedient birds, who stopped behind, all perished.
His lesson ended, the Master preached the Four Truths (at the close whereof that Brother won Arahatship) and identified the Birth by saying, "The loyal and obedient birds of those days are now become my disciples, and I myself was then the king of the birds."