This is how I heard. At one time the Blessed One was staying in the province of Pāvā, at the Ajakalāpaka holy place, the residence of the demon Ajakalāpaka. There, the Blessed One was sitting in the open air, in the pitch-black darkness of the night. It was also gently raining.
Suddenly, the demon Ajakalāpaka approached the Blessed One desiring to cause fear, terror, and to make the Blessed One’s hair stand on end. Having come close to the Blessed One, the demon emitted three times a terrifying cry, saying, “Hey monk, look a ghost is near you!”
Then, the Blessed One, who had no fear at all, spoke the following inspired verse,
“Once the liberated monk has crossed over the cycle of rebirths through his developed wholesome qualities, he has gone beyond this ghost and his terrifying cry.”