Final answer:
The defense mechanism described is rationalization, where a person justifies behavior with acceptable reasons, sidestepping the true, less acceptable motivations.
Step-by-step explanation:
The defense mechanism described in the question is known as rationalization. This occurs when a person justifies behaviors by substituting socially acceptable reasons for the real, less acceptable reasons underlying their actions. It serves to reduce guilt over the behavior and protect the individual’s self-concept. For instance, someone who diets all day and then eats candy bars in the evening might rationalize the behavior by telling themselves that they've earned it due to their strict dieting, thereby ignoring their underlying reasons for wanting the candy, such as emotional comfort or hunger.