But I tell you that anyone who looks at a woman lustfully has already committed adultery with her in his heart.
The heart is where our actions start. What we do, good or bad, is a result of where our heart is. Even if one were able to keep from performing sinful acts, the mind is sinful and still thinks about them. Not carrying out a sinful act may prevent someone else from getting hurt but the damage is still done internally.
Jesus uses the illustration of lust in this passage but He says the same thing about murder elsewhere. If we say something harmful to another person, we are killing their character. It doesn’t matter from God’s perspective that we did no physical deed, we still intentionally harmed someone.
Taming the heart is much more difficult to tame than actions. Only with the help of the Holy Spirit do we stand a chance at controlling our heart and our mind. If we are able to control these however, our actions will come easily because they are a reflection of our heart.
Some people can train their actions against their will. They may be able to avoid doing something or acting a particular way in front of certain people but while alone their true nature will come out. If nothing else, we can’t fool God into believing that we are good just because we abstain from certain actions. He knows our heart and it is the heart that He will judge.