By St. Gregory of Sinai
Here something must be said about delusion, so far as this is possible; for, because of its deviousness and the number of ways in which it can ensnare us, few recognize it clearly and for most it is almost inscrutable. Delusion manifests itself or, rather, attacks and invades us in two ways - in the form of mental images and fantasies or in the form of diabolic influence - though its sole cause and origin is always arrogance. The first form is the origin of the second and the second is the origin of a third form - mental derangement. The first form, illusory visions, is caused by self-conceit; for this leads us to invest the divine with some illusory shape, thus deceiving us through mental images and fantasies. This deception in its turn produces blasphemy as well as the fear induced by monstrous apparitions, occurring both when awake and when asleep - a state described as the terror and perturbation of the soul. Thus arrogance is followed by delusion, delusion by blasphemy, blasphemy by fear, fear by terror, and terror by a derangement of the natural state of the mind. This is the first form of delusion, that induced by mental images and fantasies. The second form, induced by diabolic influence, is as follows. It has its origin in self-indulgence, which in its turn results from so-called natural desire. Self-indulgence begets licentiousness in all its forms of indescribable impurity. By inflaming man's whole nature and clouding his intelligence as a result of its intercourse with spurious images, licentiousness deranges the intellect, searing it into a state of delirium and impelling its victim to utter false prophecies, interpreting the visions and discourses of certain supposed saints, which he claims arc revealed to him when he is intoxicated and befuddled with passion, his whole character perverted and corrupted by demons. Those ignorant of spiritual matters, beguiled by delusion, call such men 'little souls'. These 'little souls' are to be found sitting near the shrines of saints, by whose spirit they claim to be inspired and tested, and whose purported message they proclaim to others. But in truth they should be called possessed by the demons, deceived and enslaved by delusion, and not prophets foretelling what is to happen now and in the future. For the demon of licentiousness himself darkens and deranges their minds, inflaming them with the fire of spiritual lust, conjuring up before them the illusory appearance of saints, and making them hear conversations and see visions. Sometimes the demons themselves appear to them and convulse them with fear. For having harnessed them to the yoke of Belial, the demon of licentiousness drives them on to practice their deceits, so that he may keep them captive and enslaved until death, when he will consign them to hell.
Delusion arises in us from three principal sources: arrogance, the envy of demons, and the divine will that allows us to be tried and corrected. Arrogance arises from superficiality, demonic envy is provoked by our spiritual progress, and the need for correction is the consequence of our sinful way of life. The delusion arising solely from envy and self-conceit is swiftly healed, especially when we humble ourselves. On the other hand, the delusion allowed by God for our correction, when we are handed over to Satan because of our sinfulness, God often permits to continue until our death, if this is needed to efface our sins. Sometimes God hands over even the guiltless to the torment of demons for the sake of their salvation. One should also know that the demon of self-conceit himself prophesies in those who are not scrupulously attentive to their hearts.
Question: What should we do when the devil transforms himself into an angel of light (cf. 2 Cor. 11:14) and tries to seduce us?
Answer: You need great discrimination in order to distinguish between good and evil. So do not readily or lightly put your trust in appearances, but weigh things well, and after testing everything carefully cleave to what is good and reject what is evil (cf. 1 Thess. 5:21-2). You must test and discriminate before you give credence to anything.
You must also be aware that the effects of grace are self-evident, and that even if the devil does transform himself he cannot produce these effects: he cannot induce you to be gentle, or forbearing, or humble, or joyful, or serene, or stable in your thoughts; he cannot make you hate what is worldly, or cut off sensual indulgence and the working of the passions, as grace does. He produces vanity, haughtiness, cowardice and every kind of evil. Thus you can tell from its effects whether the light shining in your soul is from God or from Satan. The lettuce is similar in appearance to the endive, and vinegar, to wine; but when you taste them the palate discerns and recognizes the differences between each. In the same way the soul, if it possesses the power of discrimination, can distinguish with its noetic sense between the gifts of the Holy Spirit and the illusions of Satan.
Source: "One Hundred and Thirty-Seven Texts", Philokalia, vol. 4.
Read more here.