Imam Ali (AS) said:
A bad act which makes you sad and sorry (like lying and then you become sorry for telling that lie) is better with God than the good deed (like performing Salaat or fasting) which makes you to self-conceit and vanity (because regret can remove the sin; and self-conceit in good deed is a sin which destroys that good deed) [1].
[1] Nahjul Balaghah, Wisdom 43.
Source: en.shafaqna.com