Consciousness is the essence of religiosity and unconsciousness is the basis of all that is not religious. Whatever we do, it's fine as long as we do it consciously, and it's wrong when we do it unconsciously. No action in itself is good or bad, everything depends on the state of your consciousness at the time of the action.
Once Buddha passed through a town. At that time he had not yet become a Buddha; I kept looking, I was a seeker, I had not lit up. I was talking to a friend when a fly settled on his forehead. Buddha continued talking and walking, and he ran the fly with his hand mechanically.
Suddenly, he stopped and consciously raised his hand to scare the fly on his forehead, but the fly was no longer there.
The friend asked him: are you crazy? Now what do you want to scare?
Buddha replied:
I am frightening the fly consciously; as I should have done from the beginning.
But I was entertained talking to you and I did it unconsciously, my hand did it mechanically. I was not conscious, that is why now I have done it again, being totally conscious. Now I am fully aware of the movement of my hand and I was with it when the fly was frightened.
My mind is completely present in the action and not elsewhere. I have retired the fly again, but this time I have done it consciously. The first time I made a mistake and that's why it's wrong.
Buddha used to tell his disciples: "whatever you do, you should always do it with conscience, if you take a step unconsciously, go back and repeat it again, being fully aware of what you are doing"