I found this from Gene Veith, as recorded in Loving God With All Your Mind, to be very insightful:
A young man is raised in a Christian home and has some measure of belief in Christ. He then becomes involved in some sort of overt sin. This can be any sin—pride, covetousness, addiction, dishonoring of parents, worldliness. It is often a sexual sin. He has the honesty and presence of mind to realize that this favorite sin is incompatible with the Christian faith. He has the moral sensitivity to experience guilt.
There are two ways he can respond. He may repent of the sin and turn to Christ to receive full and free forgiveness. Or he may hold on to the sin, treasure it, and refuse to give it up either overtly or emotionally. He starts to center his life around the sin, to seek from it consolation, help, and escape, to find in it, in effect, the meaning of his life.
But what about the guilt? If he is not interested in repenting and being forgiven, then there is only one way to end the torment: to reject whatever it is that brands his life as evil. If what I am doing is not really wrong, then I can “feel good about myself.” If there is no objective standard of right and wrong, I can do as I please. If there is no God, then I am not a sinner.
At this point, the “pretexts” are discovered. There are many reasons not to believe in God. They become extremely persuasive to someone who does not want God to exist. The arguments with the most force become those that turn one’s own moral failures against the Judge, so that the person’s own sinfulness is projected onto God Himself: “I can never believe in God because He allows so much evil in the world.” God becomes imagined not as the source of good, but as the source of evil.