In temptations against chastity, the spiritual masters advise us, not so much to contend with the bad thought, as to turn the mind to some spiritual, or, at least, indifferent object. It is useful to combat other bad thoughts face to face, but not thoughts of impurity.
Alphonsus Liguori