Section 94 in Indian Penal Codes
Title: Act to which a person is compelled by threats
Except murder, and offences against the State punishable with death, nothing is an offence which is done by a person who is compelled to do it by threats, which, at the time of doing it, reasonably cause the apprehension that instant death to that person will otherwise be the consequence: Provided the person doing the act did not of his own accord, or from a reasonable apprehension of harm to himself short of instant death, place himself in the situation by which he became subject to such constraint. Explanation 1.—A person who, of his own accord, or by reason of a threat of being beaten, joins a gang of dacoits, knowing their character, is not entitled to the benefit of this exception, on the ground of his having been compelled by his associates to do anything that is an offence by law. Explanation 2.—A person seized by a gang of dacoits, and forced, by threat of instant death, to do a thing which is an offence by law; for example, a smith compelled to take his tools and to force the door of a house for the dacoits to enter and plunder it, is entitled to the benefit of this exception.
Title: Act causing slight harm
Nothing is an offence by reason that it causes, or that it is intended to cause, or that it is known to be likely to cause, any harm, if that harm is so slight that no person of ordinary sense and temper would complain of such harm.
Title: Things done in private defence
Nothing is an offence which is done in the exercise of the right of private defence.
Title: Right of private defence of the body and of property
Every person has a right, subject to the restrictions contained in section 99, to defend—
(First) — His own body, and the body of any other person, against any offence affecting the human body;
(Secondly) —The property, whether movable or immovable, of himself or of any other person, against any act which is an offence falling under the definition of theft, robbery, mischief or criminal trespass, or which is an attempt to commit theft, robbery, mischief or criminal trespass.
Title: Right of private defence against the act of a person of unsound mind etc
When an act, which would otherwise be a certain offence, is not that offence, by reason of the youth, the want of maturity of understanding, the unsoundness of mind or the intoxication of the person doing that act, or by reason of any misconception on the part of that person, every person has the same right of private defence against that act which he would have if the act were that offence. Illustrations
(a) Z, under the influence of madness, attempts to kill A; Z is guilty of no offence. But A has the same right of private defence which he would have if Z were sane.
(b) A enters by night a house which he is legally entitled to enter Z, in good faith, taking A for a house-breaker, attacks A. Here Z, by attacking A under this misconception, commits no offence. But A has the same right of private defence against Z, which he would have if Z were not acting under that misconception