The following is not legal advice but is for information only. Legal advice is when an attorney applies the law to a person's individual circumstances and advises them on their legal options or potential exposure to legal harm, which a web page clearly does not.
The following are potential defenses that are set out in statute:
Ignorance or mistake
One possible defense is “Ignorance or Mistake”. The ignorance or mistake can be about a fact or law that may create reasonable doubt about the existence of a required state of mind. Taking something (a theft) that you thought was yours would be a likely fit here. However it is only available if the law recognizes ignorance as a defense for a particular offense.
The defense isn’t available if the defendant would still be guilty of another crime under the alternative circumstances or reason. An affirmative defense (it has to be proven by a defendant rather than overcome by the government) is possible if the defendant’s actions, based on belief, do not legally constitute a crime under certain conditions.
It would also be a defense if a person relied on an official statement about a law, a judge’s decision, an administrative order, or an official interpretation by someone responsible for enforcement.
Getting or being intoxicated because you did it yourself can be a defense to a crime, as long as the state of mind for an offense does not include recklessness. Being involuntarily intoxicated - because someone spiked your drink for instance - can be a defense, even for offenses where recklessness is included as an element.
This defense can best be described as committing one crime to avoid another harm. It is potentially available if conduct that a person believes to be necessary to avoid imminent physical harm to themselves or someone else. It has to be justifiable if the urgency of avoiding the harm outweighs what the crime charges sought to prevent. This is based on a mythical concept of ‘ordinary standards of reasonableness.’ One might think of criminal speeding to get someone gravely injured to a hospital. The person would die (a harm to be prevented) unless they get urgent medical attention. But the speeding over 30mph is a criminal offense. The harm to the person gravely injured would have to outweigh the harm caused (with the potential for an accident) by going that fast. Perhaps another example might be ramming a car to get it off of railroad tracks, obviously causing deliberate damage to the vehicle on the tracks. A jury would have to decide if a defense is available based on facts the facts raised.
This is perhaps the most interesting defense. A person can deliberately commit a crime but have a defense if they are under the threat of death or serious bodily injury - either to themselves or someone else - and were compelled to commit the crime by force. That even includes committing a homicide.
As this deals with abstract concepts, this can be difficult. However, if an act was done involuntarily, it is a defense. That can also be be omission under certain circumstances, and by possession of something. An example might be a body movement that causes an assault but was because of a medical condition, or criminally speeding because your accelerator was jammed. Neither was deliberately done by the person charged.
Force in defense of premises or property
A person who possesses or controls premises - or even someone simply legally allowed to be there - can use non-deadly force to stop someone trespassing. Deadly force can be used to stop an arson, or some other crime, if there’s a warning first, or it would be too dangerous to give one.
If someone believes another person is stealing their property or is damaging it, a reasonable degree of non-deadly force can be used to prevent the theft / damage or to retake it. The statute allowing this defense only appears to apply to the person whose property it actually belongs to.
Force in defense of a person
A person can use non-deadly force to a reasonable degree to prevent someone else or themselves from another use of force. It doesn’t apply with a provocation or if the person using the defense was the initial aggressor and doesn’t communicate that they are withdrawing from the situation. Mutually agreed combat also doesn’t apply to this defense. The defense can never be used against police officers, even with an illegal arrest.
Deadly force can be used when the threat to themselves or another person is also potentially deadly. Robbery, kidnapping, and burglary with a threat of injury, also justifies use of deadly force as a defense. Again, provocation or being the initial aggressor doesn’t allow the defense. If a safe retreat (except in a home) is possible, the defense is unavailable.
It may seem obvious but if conduct was allowed, it is a defense in most instances. However, if the consent is to an injury, the injury can’t be life threatening or serious. Participation in a sport or medical / scientific procedure is covered, as long as the result is what would be regarded as reasonably foreseeable and / or someone gave consent. There are other instances where this defense does not apply - like undue influence, mental incompetence, youth, undue influence (by a person with authority or family responsibility), or intoxication. The issue there is the mental ability to actually give the consent freely and without pressure.
This is also known as abnormal condition of the mind. It can be a defense if someone has a mental illness that is normally controlled but, for instance, there was a crisis because of some other issue - perhaps a problem with medication.
As with other defenses, this gets to the heart of a persons’s ability to know that what they did was wrong. It is really for extreme mental illness where a person loses correct perception of reality. It is an affirmative defense, which means it must be proven by the defense rather than rebutted by the government.