The Bodhisatta was once King Makhadeva. He reigned with wisdom and virtue for eighty-four thousand years. Before taking the throne, he had served as prince and viceroy, each for the same length of time. Throughout the Bodhisatta’s life, his barber had standing orders to inform him if he spotted a grey hair. When the first grey strand appeared, the Bodhisatta became fixated on his death and decided to immediately abdicate and live out his final eighty-four thousand years as an ascetic in a mango grove. That same day, he passed the throne to his eldest son, gave a village as a gift to his barber, and walked away from society. During this final phase of his life, the Bodhisatta cultivated the four perfect virtues, and he was reborn in heaven after he died. His story continues as King Nimi in the Nimi Jataka (#541).
In the Lifetime of the Buddha
One time the Buddha heard some of his disciples discussing the magnificence of his Great Renunciation, which was the beginning of his path to enlightenment. He said he had renounced the world in previous lives too and told them this story as an example.
The barber was an earlier birth of Ananda, one of the Buddha’s top disciples, and the king’s son was an earlier birth of the Buddha’s son.