One can distinguish five reasons why God allows the devils to attack us: first, so that from attack and counter attack attack we may become practiced in discerning good from evil; second, so that our virtue may be maintained in the heat of the struggle and so be confirmed in an impregnable position; third, So that as we advanced in virtue we may avoid presumption and learn humility; fourth, to inspire in us in unreserved hatred for evil through the experience with us have of it; fifth, and above all, that we may attain inner freedom and remain convinced both of our own weakness and of the strength of him who has come to our aid.
MAXIMUS THE CONFESSOR Centuries on Charity