Justification defense (excludente de ilicitude)
A situation in which the law rules out a crime even though the act was committed, such as necessity, self-defense, and strict performance of a legal duty. The person remains liable for any excess.
Legal reference: Brazilian Penal Code, art. 23.