We cannot justify a physical sin by mentally distracting ourselves from our actions. It’s like asking if it’s okay to shoplift as long as you are thinking about feeding the homeless. Your mind may be doing one thing, but your actions say another. You could even compare it to the kiss of Judas. His body showed love to Christ, but his intentions were the opposite. When you masturbate while trying not to lust, it’s like doing the reverse. You are supposedly doing something noble with your mind, and something ignoble with the gift of your sexuality.
The problem with masturbation is not simply the lust of the imagination, but the misuse of the body. But click here for an explanation of that.
What’s happening is that you’re trying to bargain with temptations. We know from revelation that Satan is an exceptionally cunning fallen angel. The name “Lucifer” means “light-bearer,” and this means that his intellectual abilities far surpass anyone’s on the planet. When you try to cut a deal with him, you lose—every time. How many times has he duped us into thinking, “Oh, it’s not that big of a sin. God will understand. I can go to confession later. How am I supposed to be perfect? It will just be this one time. . . , etc.”? We should not reason with our lust or make excuses for it. We must reject it, so that we can be free to love. Click here for tips on how to overcome the habit.