SB 3.20.40
srstva bhuta-pisacams ca
bhagavan atma-tandrina
dig-vasaso mukta-kesan
viksya camilayad drsau
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada:
The glorious Brahma next evolved from his sloth the ghosts and fiends, but he closed his eyes when he saw them stand naked with their hair scattered.
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada:
Ghosts and mischievous hobgoblins are also the creation of Brahma; they are not false. All of them are meant for putting the conditioned soul into various miseries. They are understood to be the creation of Brahma under the direction of the Supreme Lord.