Sin begins with

Imam Ibn al-Qayyim (may Allah have mercy on him) said:

“Sin begins with a thought, which becomes a suggestion, which turns into a desire, which turns into a determination, until it becomes an act.

Later, it can be impossible to leave. So fight bad thoughts.”

See Ad-da wa ad-dawa p. 82.