I think:
our behavior or attitudes depends on our thoughts.
When we have weakness in thought, we may do some wrong acts.
and if this happen frequently, those acts may become wrong habbits.
Wrong habbits also can change our attitude.
and the attitude is that changes our character.