Temptation goes back to the Garden of Eden when Eve was tempted by the serpent to eat of the Tree of Knowledge. We are all tempted whether we give in to those temptations or not.
Just because we are tempted doesn’t mean that we have to succumb to temptation. God said that he never tempts us more than we can bear and that he ALWAYS provides a way of escape for us should we choose it. Granted, that way is not always easy, but it is there if we only call upon Him for help.
While we can ask forgiveness when we sin, it is best to resist when temptations arise. The Bible states there are rewards for those who manage to resist.
What is the best way to resist? When you’re tempted, turn to God in prayer immediately. Open your Bible. Pray until the desire to fulfill whatever lust was tempting you passes.