Temptation, by its very nature, feels wrong. God’s moral law is written in the heart of every human being (Romans 1:20), and when a sinful temptation is introduced, our consciences immediately sense danger. However, the temptation itself is not the sin. Jesus was tempted (Mark 1:13; Luke 4:1-13), but He never sinned (Hebrews 4:15). Sin occurs when we mishandle temptation.
There are two avenues by which we are tempted: Satan and our own sinful flesh. Acts 5 gives an example of someone tempted by Satan. Ananias and his wife, Sapphira, wanting to appear more spiritual than they really were, lied to the apostles and pretended they were giving as an offering the full price of some property they had sold. Peter confronted them: “How is it that Satan has so filled your heart that you have lied to the Holy Spirit and have kept for yourself some of the money you received for the land?”(verse 3). In this instance, Peter knew that the temptation to lie had come from Satan. Ananias and his wife both gave in to that temptation (verses 7-10). The betrayal of Jesus by Judas Iscariot is also attributed to Satan’s influence (Luke 22:3; John 13:2).
Ultimately, since Satan is the "god of this world" (2 Corinthians 4:4) and the father of lies (John 8:44), all evil originates with him. However, our own selfish nature is an ally of Satan’s. We need no prompting from Satan to entertain sinful ideas. James 1:13-14 says, "When tempted, no one should say, 'God is tempting me.' For God cannot be tempted by evil, nor does he tempt anyone; but each person is tempted when they are dragged away by their own evil desire and enticed."
Even though we may desire to do good, we are all tempted. No one is above it, even someone like the apostle Paul. He shared his own struggle of flesh against spirit when he wrote in Romans 7:22-23, "For in my inner being I delight in God’s law; but I see another law at work in me, waging war against the law of my mind and making me a prisoner of the law of sin at work within me."
Temptation is not of itself sinful. It becomes sin when we allow the temptation to become action, even in our minds. Lust, for example, is sin even though it may never be acted upon (Matthew 5:28). Covetousness, pride, greed, and envy are all sins of the heart; even though they may not be apparent to anyone else, they are still sin (Romans 1:29; Mark 7:21-22). When we give in to the temptation to entertain such thoughts, they take root in our hearts and defile us (Matthew 15:18–19). When we yield to temptation, we replace the fruit of the Spirit with the fruit of the flesh (Ephesians 5:9; Galatians 5:19-23). And, many times, what was first entertained as a thought becomes action (see James 1:15).
The best defense against giving in to temptation is to flee at the first suggestion. Joseph is a great example of someone who did not allow temptation to become sin (Genesis 39:6–12). Although tempted to sin sexually, he did not give the temptation time to take root. He used the legs God gave him and physically fled. Rather than stay in a potentially dangerous situation and try to talk, reason, justify, explain, or otherwise weaken his resolve, Joseph took off. The temptation was not sin for him because he dealt with it in a God-honoring way. It could easily have become sin if Joseph had stayed around and tried to overcome the temptation in his own strength.
Romans 13:13-14 (ESV) gives us a guideline for avoiding situations that can lead to temptation. "Let us walk properly as in the daytime, not in orgies and drunkenness, not in sexual immorality and sensuality, not in quarreling and jealousy. But put on the Lord Jesus Christ, and make no provision for the flesh, to gratify its desires." If we determine to "make no provision for the flesh," we will keep ourselves out of situations that may prove too tempting. When we put ourselves in situations where we know we will be tempted, we are asking for trouble. God promises to provide a "way of escape" when we are tempted (1 Corinthians 10:13), but often that way is to avoid the situation altogether. “Flee the evil desires of youth” (2 Timothy 2:22). Jesus taught us to pray, "Lead us not into temptation" (Luke 11:4), but we have a responsibility to pay attention to the direction God is leading us and avoid temptation whenever we can.