BG Chap 18 - The thinking of the intelligent in relation to action
One who is not motivated by false ego thinking himself as the doer, and is not attached to the actions thinking them good or bad, does not kill people, even though he kills them, and is not contaminated by the killing. The person who understands that his actions are dependent on the Lord, and does not think that he alone is the doer, whose intelligence is not contaminated by desires for results of his actions is not bound by his actions. Though it may appear from ordinary vision that he has killed others, he actually does not kill from his own vision because he has no motive for the action.
Here the Lord informs Arjuna that the desire not to fight arises from false ego. Arjuna thought himself to be the doer of action, but he did not consider the supreme sanction within and without. But one who knows the instruments of work, himself as the worker, and the Supreme Lord as the supreme sanctioner is perfect in doing everything. Such a person is never in illusion. Personal activity and responsibility arise from false ego and godlessness, or a lack of Kṛṣṇa consciousness. Anyone who is acting in Kṛṣṇa consciousness under the direction of the Supersoul or the Supreme Personality of Godhead, even though killing, does not kill. Nor is he ever affected by the reaction of such killing. When a soldier kills under the command of a superior officer, he is not subject to be judged. But if a soldier kills on his own personal account, then he is certainly judged by a court of law.