At Sāvatthi.
Once, King Pasenadi of Kosala was sitting to one side, and he said to the Blessed One: “Here, Venerable Sir, when I was alone in seclusion, a reflection arose in my mind: ‘Who are dear to themselves, and who are not dear to themselves?’”
Then it occurred to me, Venerable Sir: "Those who engage in misconduct by body, speech, and mind; they are not dear to themselves. Even though they might say, ‘We are dear to ourselves,’ still, they are not dear to themselves. Why is that? Because whatever a person who is not dear to themselves would do to someone who is not dear to them, they do just that to themselves. Therefore, they are not dear to themselves.
But those who engage in good conduct by body, speech, and mind; they are dear to themselves. Even though they might say, ‘We are not dear to ourselves,’ still, they are dear to themselves. Why is that? Because whatever a person who is dear to themselves would do to someone who is dear to them, they do just that to themselves. Therefore, they are dear to themselves."
"That is how it is, great king, that is how it is, great king. Those who engage in misconduct by body, speech, and mind; they are not dear to themselves. Even though they might say, ‘We are dear to ourselves,’ still, they are not dear to themselves. Why is that? Because whatever a person who is not dear to themselves would do to someone who is not dear to them, they do just that to themselves. Therefore, they are not dear to themselves.
But those who engage in good conduct by body, speech, and mind; they are dear to themselves. Even though they might say, ‘We are not dear to ourselves,’ still, they are dear to themselves. Why is that? Because whatever a person who is dear to themselves would do to someone who is dear to them, they do just that to themselves. Therefore, they are dear to themselves."
"If one perceives oneself as dear, One should not associate with evil actions. It is not easy to achieve happiness, For one who does harmful actions.
Overcome by the end-maker (death), Having abandoned the human existence, What does one have as their own? What do they take when they go? What follows them like a shadow That never departs?
Both good and evil, Whatever a mortal does here, That is what is truly theirs, That is what they take when they go, That is what follows them Like a shadow that never departs.
Therefore, one should do good deeds, A collection for the future life. Merits are the support for beings, In the next world."
Related Teachings:
The way to look after yourself and others | At Sedaka (SN 47.19) - Two acrobats discuss whether one should support the other, or the other way around. The Buddha says they should support each other. In the same way we should practice the four kinds of mindfulness meditation both for one’s own benefit and to protect others.
Who to not associate with (AN 3.27) - The Buddha shares guideline on choosing one’s associations and company. For it is through associations that one can decline, avoid decline or grow in qualities.
Guarding against irritability in body, speech, thought (DhP 231, 232, 233, 234) - The Buddha is advising against getting irritated, for bad conduct by way of body, speech or thoughts that fuel growth of ignorance (misapprehension of true reality/misapprehension of how things have come to be).