St Maximos the Confessor. "Four Hundred Texts on Love". Second Century. From Philokalia, Vol. 2.
67. There are said to be five reasons why God allows us to be assailed by demons. The first is so that, by attacking and counterattacking, we should learn to discriminate between virtue and vice. The second is so that, having acquired virtue through conflict and toil, we should keep it secure and immutable. The third is so that, when making progress in virtue, we should not become haughty but learn humility. The fourth is so that, having gained some experience of evil, we should ‘hate it with perfect hatred’ (cf. Ps. 139:22). The fifth and most important is so that, having achieved dispassion, we should forget neither our own weakness nor the power of Him who has helped us.