Bhagavad Gita 17.4

यजन्ते सात्त्विका देवन्यारक्षान्सि राजसा: |
प्रेतान्भूतगणाश्चन्ये यजन्ते तामसा जना:

Translation

Those in the mode of goodness worship the celestial gods; those in the mode of passion worship the yakṣhas and rākṣhasas; those in the mode of ignorance worship ghosts and spirits.