Khemā, wife of Saṃyama, king of Bārāṇasī, had a dream, after which she longed to see a golden goose (haṃsa) teach the law from the royal throne. When the king came to know this, he consulted various people, and, acting on their advice, had a pond dug to the north of the city in the hope of enticing a golden goose there, and appointed a fowler, who came to be called Khemaka, to look after the pond.
The plan succeeded. Five different kinds of geese came: the grass geese, the yellow geese, the scarlet geese, the white geese, and the pāka geese.
Dhataraṭṭha, king of the golden geese, who lived in Cittakūṭa, had taken as wife a pāka goose, and at the repeated suggestion of his minister, Sumukha, arrived with his flock of ninety thousand, to see the wonderful pond at Bārāṇasī. Khemaka saw them and waited his opportunity. On the seventh day he found it, and set a snare in which Dhataraṭṭha was caught. At his cry of alarm the flock fled, with the exception of Sumukha, who stayed and asked Khemaka for permission to take Dhataraṭṭha’s place. When Sumukha heard why they had been caught, he asked that both he and Dhataraṭṭha should be taken before Saṃyama. When Saṃyama heard of Sumukha’s devotion he was greatly touched, and showed the geese every possible honour, after asking their forgiveness for the way they had been treated. Dhataraṭṭha taught the queen and the royal household, and, having exhorted the king to rule righteously, returned to Cittakūṭa.
The story was told in reference to Ānanda’s attempt to sacrifice his own life for that of the Buddha, when Nāḷāgiri (q.v.) was sent to kill him.