Final answer:
The necessity defense is used when a defendant admits to the act but justifies it as a response to avoid a greater harm, distinguishing it from alibi, duress, and insanity defenses.
Step-by-step explanation:
The legal defense in which the defendant admits to committing the act but claims it was necessary to avoid a greater evil is known as the necessity defense.
This is distinct from an alibi defense, where the defendant claims to be innocent due to being elsewhere when the crime occurred; a duress defense, where the defendant claims to have committed the act under immediate threat of harm; and an insanity defense, where the defendant admits to the act but claims a lack of understanding due to mental illness.
The necessity defense acknowledges the act but justifies it as the lesser of two evils in an emergency situation with no legal alternatives.