Reaction formation, as described by Wikipedia. Really, this is worth a read, particularly the last two paragraphs:
In psychoanalytic theory, reaction formation is a defensive process (defense mechanism) in which anxiety-producing or unacceptable emotions and impulses are mastered by exaggeration (hypertrophy) of the directly opposing tendency.
Reaction formation depends on the hypothesis that
"[t]he instincts and their derivatives may be arranged as pairs of opposites: life versus death, construction versus destruction, action versus passivity, dominance versus submission, and so forth. When one of the instincts produces anxiety by exerting pressure on the ego either directly or by way of the superego, the ego may try to sidetrack the offending impulse by concentrating upon its opposite. For example, if feelings of hate towards another person make one anxious, the ego can facilitate the flow of love to conceal the hostility."
Where reaction-formation takes place, it is usually assumed that the original, rejected impulse does not vanish, but persists, unconscious, in its original infantile form. Thus, where love is experienced as a reaction formation against hate, we cannot say that love is substituted for hate, because the original aggressive feelings still exist underneath the affectionate exterior that merely masks the hate to hide it from awareness.
In a diagnostic setting, the existence of a reaction-formation rather than a 'simple' emotion would be suspected where exaggeration, compulsiveness and inflexibility were observed. For example,
"[r]eactive love protests too much; it is overdone, extravagant, showy, and affected. It is counterfeit, and [...] is usually easily detected. Another feature of a reaction formation is its compulsiveness. A person who is defending himself against anxiety cannot deviate from expressing the opposite of what he really feels. His love, for instance, is not flexible. It cannot adapt itself to changing circumstances as genuine emotions do; rather it must be constantly on display as if any failure to exhibit it would cause the contrary feeling to come to the surface.
Reaction formation is sometimes described as one of the most difficult defenses for lay people to understand; this testifies not merely to its effectiveness as a disguise, but also to its ubiquity and flexibility as a defense that can be utilized in many forms. For example,
"solicitude may be a reaction-formation against cruelty, cleanliness against coprophilia",
and it is not unknown for an analyst to explain a client's unconditional pacifism as a reaction formation against their sadism. In addition,
"[h]igh ideals of virtue and goodness may be reaction formations against primitive object cathexes rather than realistic values that are capable of being lived up to. Romantic notions of chastity and purity may mask crude sexual desires, altruism may hide selfishness, and piety may conceal sinfulness."
Even more counter-intuitively, according to this model
"[a] phobia is an example of a reaction formation. The person wants what he fears. He is not afraid of the object;he is afraid of the wish for the object. The reactive fear prevents the dreaded wish from being fulfilled.
The concept of reaction formation has been used to explain responses to external threats as well as internal anxieties. In the phenomenon described as Stockholm Syndrome, a hostage or kidnap victim 'falls in love' with the feared and hated person who has complete power over them. Similarly paradoxical reports exist of powerless and vulnerable inmates of Nazi camps creating 'favourites' among the guards and even collecting objects discarded by them.
The mechanism of reaction formation is often characteristic of obsessional neuroses. When this mechanism is overused, especially during the formation of the ego, it can become a permanent character trait. This is often seen in those with obsessional character and obsessive personality disorders. This does not imply that its periodic usage is always obsessional, but that it can lead to obsessional behavior.
A man who is overly aroused by pornographic material who utilizes reaction formation may take on an attitude of criticism toward the topic. He may end up sacrificing many of the positive things in his life, including family relationships, by traveling around the country to anti-pornography rallies. This view may become an obsession, whereby the man eventually does nothing but travel from rally to rally speaking out against pornography. He continues to do this, but only feels temporary relief, because the deeply rooted arousal to an unacceptable behaviour such as watching pornography is still present, and underlying the implementation of the defense. At that point he can be said to have developed an obsessional personality above and beyond the defense mechanism.
Homophobia, as recent news stories attest, is particularly suspect. Men - and it is men usually - who devote their public lives to the squashing of gay rights are often compelled to out themselves in the most tawdry and public way: sex in bathrooms, employing male prostitutes, as if to confirm the crudest notions of the reviled homosexual sex acts.
Similarly, a strongly heterosexual individual who is fearful/hateful toward those who identify themselves as homosexual and bisexual. The person may be seeking to counteract deep-seated and often untouched homosexual desires. A reaction formation is used to exaggerate heterosexual behavior outward, to relieve inward anxiety regarding homosexual desires.