This is one of those things - when you're talking about intrusive thoughts, mental health professionals will tell you that the thought sticks because it is horrifying to you and violates your values. The vast majority of people who have those kinds of thoughts never commit a crime.