The practice of equanimity is particularly helpful for nightmares. Of all the practices you could apply, it is most helpful and comforting, after you have awakened, to generate a sense of equanimity – the similarity of aim – between yourself and the dream-monster. In meditation, contemplate: "Just as I want happiness and don't want suffering, so that monster wants happiness and doesn't want suffering."

It might seem weird to reify your dream objects into sentient beings, since they really do not exist except as figments of the imagination, but try to see the being as wanting happiness and not wanting suffering, as having been a friend, and, when a friend, having extended great kindness. Don't turn this into a test of the meditation. Don't think, "It's got to work on this, and if it doesn't, then the system doesn't work." Just try it, play with it a little. Experience is needed before these meditations will work across boundaries of feeling. But when they do work, you will feel the fear dissipate.

We are seeking to disempower a complex that appears as a dream-monster, and the power of equanimity dissolves the fear that empowers the monster. Even when you don't believe it, this technique works. In meditation, contemplate: "This nightmare-spider, like me, wants happiness and does not want suffering; so may this nightmare-spider have happiness and be free from suffering."

Let's consider nightmarish figures such as Hitler and Stalin who have appeared in the world. They had very strange ideas about achieving happiness, through bringing extreme pain on others. Nevertheless, no matter how crazy they were, how stupid, how silly, how demented, still – just like me – they wanted happiness and didn't want suffering. I will never decide that their techniques are good, but still, when they had a pain in their back, they wanted relief. They had weird ideas about how to gain happiness and a blindness to recognizing the evidence staring them in the face. But they were still sentient beings.

It helps to think that such powerfully bad persons – or ourselves when we get angry and do nasty things – have fallen out of recognition that other people want happiness and don't want suffering. From this understanding there arises a closeness with those under the influence of strong afflictive emotions.

If you familiarize yourself for a considerable period with these meditations that utilize horrific situations for increasing equanimity, reflecting on many individual people, gradually your sense of equanimity, an even-mindedness, will extend to anyone who appears.

Jeffrey Hopkins in Cultivating Compassion