What is a psychological defense mechanism?

       Psychological defense mechanism: Defense is an important concept in psychoanalytic theory, which is a function of the ego in the personality structure.  When the ego is aware of an impulse from the ego, it experiences a certain amount of anxiety in an anticipatory way and tries to stop it with certain strategies, a process called defense, or defense of ego.  Defenses are used by the ego to repel conscious impulses, internal drives, desires, and thoughts that are primarily directed at sexual desires and aggressions that cause anxiety in the individual. Generally, defense is carried out subconsciously. Therefore, the individual is not aware that it is functioning.  Depending on the level at which the individual defense mechanism is operating, the result is different.