A person came to the Prophet of Islam (PBUH) and said:
I perform my Salaats, and I do an immoral act, and I also lie! Which one must I avoid first? The Prophet (PBUH) replied: Lying. And that person promised to avoid lying forever. When he left, that person was provoked in his heart by Satan to carry out the immoral act, but immediately thought to himself that if tomorrow the Prophet (PBUH) ask him about that, what should he say? Should he say he has not done it, but that would be lying; and if he tells the truth, then he will be punished (according to Sharia Law), and this also applies to all other of his inappropriate acts. This way of thinking caused avoidance of bad deeds for that person. Therefore, avoiding lying is the origin of avoiding all sins [1].
[1] Tafseer-e-Nemoneh, Vol. 11, Page 413.