I have heard that on one occasion the Blessed One was staying at Savatthi, in Jeta's Grove, Anathapindika's monastery. There he addressed the monks: "Monks!"
"Yes, lord," the monks replied.
The Blessed One said, "Monks, before my self-awakening, when I was still just an unawakened Bodhisatta, the thought occurred to me: 'Why don't I keep dividing my thinking into two sorts?' So I made thinking imbued with sensuality, thinking imbued with ill will, & thinking imbued with harmfulness one sort, and thinking imbued with renunciation, thinking imbued with non-ill will, & thinking imbued with harmlessness another sort.
"And as I remained thus heedful, ardent, & resolute, thinking imbued with sensuality arose. I discerned that 'Thinking imbued with sensuality has arisen in me; and that leads to my own affliction or to the affliction of others or to the affliction of both. It obstructs discernment, promotes vexation, & does not lead to Unbinding.'
"As I noticed that it leads to my own affliction, it subsided. As I noticed that it leads to the affliction of others... to the affliction of both... it obstructs discernment, promotes vexation, & does not lead to Unbinding, it subsided. Whenever thinking imbued with sensuality had arisen, I simply abandoned it, destroyed it, dispelled it, wiped it out of existence.
"And as I remained thus heedful, ardent, & resolute, thinking imbued with ill will arose. I discerned that 'Thinking imbued with ill will has arisen in me; and that leads to my own affliction or to the affliction of others or to the affliction of both. It obstructs discernment, promotes vexation, & does not lead to Unbinding.'
"As I noticed that it leads to my own affliction, it subsided. As I noticed that it leads to the affliction of others... to the affliction of both... it obstructs discernment, promotes vexation, & does not lead to Unbinding, it subsided. Whenever thinking imbued with ill will had arisen, I simply abandoned it, destroyed it, dispelled it, wiped it out of existence.
"And as I remained thus heedful, ardent, & resolute, thinking imbued with harmfulness arose. I discerned that 'Thinking imbued with harmfulness has arisen in me; and that leads to my own affliction or to the affliction of others or to the affliction of both. It obstructs discernment, promotes vexation, & does not lead to Unbinding.'
"As I noticed that it leads to my own affliction, it subsided. As I noticed that it leads to the affliction of others... to the affliction of both... it obstructs discernment, promotes vexation, & does not lead to Unbinding, it subsided. Whenever thinking imbued with harmfulness had arisen, I simply abandoned it, destroyed it, dispelled it, wiped it out of existence.
"Whatever a monk keeps pursuing with his thinking & pondering, that becomes the inclination of his awareness. If a monk keeps pursuing thinking imbued with sensuality, abandoning thinking imbued with renunciation, his mind is bent by that thinking imbued with sensuality. If a monk keeps pursuing thinking imbued with ill will, abandoning thinking imbued with non-ill will, his mind is bent by that thinking imbued with ill will. If a monk keeps pursuing thinking imbued with harmfulness, abandoning thinking imbued with harmlessness, his mind is bent by that thinking imbued with harmfulness.
"Just as in the last month of the Rains, in the autumn season when the crops are ripening, a cowherd would look after his cows: He would tap & poke & check & curb them with a stick on this side & that. Why is that? Because he foresees flogging or imprisonment or a fine or public censure arising from that [if he let his cows wander into the crops]. In the same way I foresaw in unskillful qualities drawbacks, degradation, & defilement, and I foresaw in skillful qualities rewards related to renunciation & promoting cleansing.
"And as I remained thus heedful, ardent, & resolute, thinking imbued with renunciation arose. I discerned that 'Thinking imbued with renunciation has arisen in me; and that leads neither to my own affliction, nor to the affliction of others, nor to the affliction of both. It fosters discernment, promotes lack of vexation, & leads to Unbinding. If I were to think & ponder in line with that even for a night... even for a day... even for a day & night, I do not envision any danger that would come from it, except that thinking & pondering a long time would tire the body. When the body is tired, the mind is disturbed; and a disturbed mind is far from concentration.' So I steadied my mind right within, settled, unified, & concentrated it. Why is that? So that my mind would not be disturbed.
"And as I remained thus heedful, ardent, & resolute, thinking imbued with non-ill will arose. I discerned that 'Thinking imbued with non-ill will has arisen in me; and that leads neither to my own affliction, nor to the affliction of others, nor to the affliction of both. It fosters discernment, promotes lack of vexation, & leads to Unbinding. If I were to think & ponder in line with that even for a night... even for a day... even for a day & night, I do not envision any danger that would come from it, except that thinking & pondering a long time would tire the body. When the body is tired, the mind is disturbed; and a disturbed mind is far from concentration.' So I steadied my mind right within, settled, unified, & concentrated it. Why is that? So that my mind would not be disturbed.
"And as I remained thus heedful, ardent, & resolute, thinking imbued with harmlessness arose. I discerned that 'Thinking imbued with harmlessness has arisen in me; and that leads neither to my own affliction, nor to the affliction of others, nor to the affliction of both. It fosters discernment, promotes lack of vexation, & leads to Unbinding. If I were to think & ponder in line with that even for a night... even for a day... even for a day & night, I do not envision any danger that would come from it, except that thinking & pondering a long time would tire the body. When the body is tired, the mind is disturbed; and a disturbed mind is far from concentration.' So I steadied my mind right within, settled, unified, & concentrated it. Why is that? So that my mind would not be disturbed.
"Whatever a monk keeps pursuing with his thinking & pondering, that becomes the inclination of his awareness. If a monk keeps pursuing thinking imbued with renunciation, abandoning thinking imbued with sensuality, his mind is bent by that thinking imbued with renunciation. If a monk keeps pursuing thinking imbued with non-ill will, abandoning thinking imbued with ill will, his mind is bent by that thinking imbued with non-ill will. If a monk keeps pursuing thinking imbued with harmlessness, abandoning thinking imbued with harmfulness, his mind is bent by that thinking imbued with harmlessness.
"Just as in the last month of the hot season, when all the crops have been gathered into the village, a cowherd would look after his cows: While resting under the shade of a tree or out in the open, he simply keeps himself mindful of 'those cows.' In the same way, I simply kept myself mindful of 'those mental qualities.'
"Unflagging persistence was aroused in me, and unmuddled mindfulness established. My body was calm & unaroused, my mind concentrated & single. Quite withdrawn from sensuality, withdrawn from unskillful mental qualities, I entered & remained in the first jhana: rapture & pleasure born from withdrawal, accompanied by directed thought & evaluation. With the stilling of directed thoughts & evaluations, I entered & remained in the second jhana: rapture & pleasure born of composure, unification of awareness free from directed thought & evaluation — internal assurance. With the fading of rapture I remained in equanimity, mindful & alert, and physically sensitive of pleasure. I entered & remained in the third jhana, of which the Noble Ones declare, 'Equanimous & mindful, he has a pleasurable abiding.' With the abandoning of pleasure & pain — as with the earlier disappearance of elation & distress — I entered & remained in the fourth jhana: purity of equanimity & mindfulness, neither pleasure nor pain.
"When the mind was thus concentrated, purified, bright, unblemished, rid of defilement, pliant, malleable, steady, & attained to imperturbability, I directed it to the knowledge of recollecting my past lives. I recollected my manifold past lives, i.e., one birth, two... five, ten... fifty, a hundred, a thousand, a hundred thousand, many eons of cosmic contraction, many eons of cosmic expansion, many eons of cosmic contraction & expansion: 'There I had such a name, belonged to such a clan, had such an appearance. Such was my food, such my experience of pleasure & pain, such the end of my life. Passing away from that state, I re-arose there. There too I had such a name, belonged to such a clan, had such an appearance. Such was my food, such my experience of pleasure & pain, such the end of my life. Passing away from that state, I re-arose here.' Thus I remembered my manifold past lives in their modes & details.
"This was the first knowledge I attained in the first watch of the night. Ignorance was destroyed; knowledge arose; darkness was destroyed; light arose — as happens in one who is heedful, ardent, & resolute.
"When the mind was thus concentrated, purified, bright, unblemished, rid of defilement, pliant, malleable, steady, & attained to imperturbability, I directed it to the knowledge of the passing away & reappearance of beings. I saw — by means of the divine eye, purified & surpassing the human — beings passing away & re-appearing, and I discerned how they are inferior & superior, beautiful & ugly, fortunate & unfortunate in accordance with their kamma: 'These beings — who were endowed with bad conduct of body, speech & mind, who reviled the Noble Ones, held wrong views and undertook actions under the influence of wrong views — with the break-up of the body, after death, have re-appeared in the plane of deprivation, the bad destination, the lower realms, in hell. But these beings — who were endowed with good conduct of body, speech, & mind, who did not revile the Noble Ones, who held right views and undertook actions under the influence of right views — with the break-up of the body, after death, have re-appeared in the good destinations, in the heavenly world.' Thus — by means of the divine eye, purified & surpassing the human — I saw beings passing away & re-appearing, and I discerned how they are inferior & superior, beautiful & ugly, fortunate & unfortunate in accordance with their kamma.
"This was the second knowledge I attained in the second watch of the night. Ignorance was destroyed; knowledge arose; darkness was destroyed; light arose — as happens in one who is heedful, ardent, & resolute.
"When the mind was thus concentrated, purified, bright, unblemished, rid of defilement, pliant, malleable, steady, & attained to imperturbability, I directed it to the knowledge of the ending of the mental fermentations. I discerned, as it had come to be, that 'This is stress... This is the origination of stress... This is the cessation of stress... This is the way leading to the cessation of stress... These are fermentations... This is the origination of fermentations... This is the cessation of fermentations... This is the way leading to the cessation of fermentations.' My heart, thus knowing, thus seeing, was released from the fermentation of sensuality, released from the fermentation of becoming, released from the fermentation of ignorance. With release, there was the knowledge, 'Released.' I discerned that 'Birth is ended, the holy life fulfilled, the task done. There is nothing further for this world.'
"This was the third knowledge I attained in the third watch of the night. Ignorance was destroyed; knowledge arose; darkness was destroyed; light arose — as happens in one who is heedful, ardent, & resolute.
"Suppose, monks, that in a forested wilderness there were a large low-lying marsh, in dependence on which there lived a large herd of deer; and a certain man were to appear, not desiring their benefit, not desiring their welfare, not desiring their rest from bondage. He would close off the safe, restful path that led to their rapture, and would open up a false path, set out a male decoy, place a female decoy, and thus the large herd of deer, at a later time, would fall into ruin & disaster. Then suppose that a certain man were to appear to that same large herd of deer, desiring their benefit, desiring their welfare, desiring their rest from bondage. He would open up the safe, restful path that led to their rapture, would close off the false path, take away the male decoy, destroy the female decoy, and thus the large herd of deer, at a later time, would come into growth, increase, & abundance.
"I have given this simile in order to convey a meaning. The meaning is this: 'The large, low-lying marsh' is a term for sensual pleasures. 'The large herd of deer' is a term for beings. 'The man not desiring their benefit, not desiring their welfare, not desiring their rest from bondage' is a term for Mara, the Evil One. 'The false path' is a term for the eightfold wrong path, i.e., wrong view, wrong resolve, wrong speech, wrong action, wrong livelihood, wrong effort, wrong mindfulness, & wrong concentration. 'The male decoy' is a term for passion & delight. 'The female decoy' is a term for ignorance. 'The man desiring their benefit, desiring their welfare, desiring their rest from bondage' is a term for the Tathagata, the Worthy One, the Rightly Self-awakened One. 'The safe, restful path that led to their rapture' is a term for the noble eightfold path, i.e., right view, right resolve, right speech, right action, right livelihood, right effort, right mindfulness, & right concentration.
"So, monks, I have opened up the safe, restful path, closed off the false path, removed the male decoy, destroyed the female. Whatever a teacher should do — seeking the welfare of his disciples, out of sympathy for them — that have I done for you. Over there are the roots of trees; over there, empty dwellings. Practice jhana, monks. Don't be heedless. Don't later fall into regret. This is our message to you."
That is what the Blessed One said. Gratified, the monks delighted in the Blessed One's words.
See also: AN 4.259