Saṁyutta Nikāya 9.11 1.

Unwholesome Thoughts Discourse

Vanavagga Akusalavitakkasutta Ekaṁ samayaṁ aññataro bhikkhu kosalesu viharati aññatarasmiṁ vanasaṇḍe.

At one time, a certain disciple was dwelling in the Kosalan country, in a certain forest grove.

Tena kho pana samayena so bhikkhu divāvihāragato pāpake akusale vitakke vitakketi, seyyathidaṁ— kāmavitakkaṁ, byāpādavitakkaṁ, vihiṁsāvitakkaṁ.

And at that time, that disciple, having gone to the forest for the day's abiding, was thinking unwholesome, corrupt thoughts, such as thoughts of sensuality, thoughts of ill-will, thoughts of harming.

Atha kho yā tasmiṁ vanasaṇḍe adhivatthā devatā tassa bhikkhuno anukampikā atthakāmā taṁ bhikkhuṁ saṁvejetukāmā yena so bhikkhu tenupasaṅkami; upasaṅkamitvā taṁ bhikkhuṁ gāthāhi ajjhabhāsi: “Ayoniso manasikārā, so vitakkehi khajjasi; Ayoniso paṭinissajja, yoniso anucintaya.

Then, the deity who was the guardian of that forest grove, compassionate and desiring his welfare, wishing to stir that disciple, approached him; having approached, that deity spoke to the disciple in verses: From improper attention, you suffer from those thoughts;

By abandoning them improperly, think properly.

Satthāraṁ dhammamārabbha, saṅghaṁ sīlāni attano; Adhigacchasi pāmojjaṁ, pītisukhamasaṁsayaṁ; Tato pāmojjabahulo, dukkhassantaṁ karissasī”ti.

Relying on the Teacher, the Dhamma, the Sangha, and your own virtues;

You will attain joy, happiness without doubt;

Then, filled with joy, you will make an end of suffering.

Atha kho so bhikkhu tāya devatāya saṁvejito saṁvegamāpādīti.

Then, that disciple, stirred by that deity, attained urgency.