In jurisprudence, animus nocendi (from Latin animus 'mind', and noceo 'to harm') is the subjective state of mind of the perpetrator of a crime, with reference to the exact knowledge of illegal content of his behaviour, and of its possible consequences.

In most modern legal systems, the animus nocendi is required as an essential condition to give a penal condemnation.

The animus nocendi is usually demonstrated by the verified presence of these elements:

knowledge of a law that prohibited the discussed action or conduct (unless there exists a systemic obligation, pending on every citizen, that considers that the law has to be known by every adult — in this case the knowledge is presumed a priori; see also Ignorantia juris non excusat);
knowledge of the most likely consequences of his action;

precise intention of breaking the law or of causing the verified effects of the action.
When the author of the crime had no animus nocendi, it is usually considered that the crime still exists, but the author is innocent, unless a responsibility for guilt can be found in his conduct: the typical case of a car accident in which a wrong or even hazardous manoeuvre causes personal injuries to another car driver, is then managed as a crime for the presence of injuries, yet the author will not be prosecuted as the author of the injuries (he did not want to hurt the other driver, thus he had no animus nocendi), but simply as the author of a dangerous conduct that indirectly caused said effects, and would be held responsible at a guilt title.
Please explain how a perpetrator's state of mind is relevant to guilt in committing a crime
In most legal systems, it is required to demonstrate that the perpetrator of a crime had intent to harm, also known by the legal term "animus nocendi"(from the Latin animus "mind" and noceo "to harm"). Put plainly, this means having foreknowledge of the illegality of his act and the repercussions of the crime. Intention is important in establishing guilt for a specific crime. A good example is a car accident fatality: the driver responsible would be guilty of causing the accidental death of the victim (manslaughter), but not guilty of murder -- unless it could be established that the driver at fault intended to kill the victim.