The enemy of my enemy is my friend

"The enemy of my enemy is my friend" is an ancient proverb which suggests that two parties can or should work together against a common enemy. The exact meaning of the modern phrase was first expressed in the Latin phrase "Amicus meus, inimicus inimici mei" ("my friend, the enemy of my enemy"), which had become common throughout Europe by the early 18th century, while the first recorded use of the current English version came in 1884.

Rajamandala
A Sanskrit treatise on statecraft, the Arthashastra of Kautilya states:

"The king who is situated anywhere immediately on the circumference of the conqueror's territory is termed the enemy. The king who is likewise situated close to the enemy, but separated from the conqueror only by the enemy, is termed the friend (of the conqueror)."

- Kautilya

A neighboring power would be the first to dispute control of territory, and therefore Kautilya finds neighboring kings to be natural enemies of any conqueror. A king whose territories border those of the enemy would also have this relationship with them, and therefore be a natural ally. This system of relationships was termed Rajamandala (meaning circle of kings) and informed the foreign policy of Chandragupta's Empire. This early theory of geopolitics is still recognized today as the Mandala theory of foreign relations.

World War II
The idea that "the enemy of my enemy is my friend" functioned in various guises as foreign policy by the Allies during World War II. In Europe, tension was common between the Western Allies and the Soviet Union. Despite their inherent differences, they recognized a need to work together to meet the threat of Nazi aggression under the leadership of Adolf Hitler. Both U.S. President Franklin D. Roosevelt and British Prime Minister Winston Churchill were wary of the Soviet Union under the leadership of Joseph Stalin. However, both developed policies with an understanding that Soviet cooperation was necessary for the Allied war effort to succeed. There is a quote from Winston Churchill made to his personal secretary John Colville on the eve of Germany's invasion of the Soviet Union (Operation Barbarossa). He was quoted as saying, "if Hitler invaded Hell, I would make at least a favourable reference to the Devil in the House of Commons." The Soviet leader reciprocated these feelings towards his Western allies. He was distrustful and feared that they would negotiate a separate peace with Nazi Germany. However, he also viewed their assistance as critical in resisting the Nazi invasion.

The doctrine of "the enemy of my enemy is my friend" was employed by nation states in regions outside of the European theater as well. In the Second Sino-Japanese War, within the Pacific theater, an alliance was formed between Chinese Communists and Chinese Nationalists. Leading up to this, these forces had battled each other throughout the Chinese Civil War. However, they formed an alliance, the Second United Front in response to the mutual threat of Japanese aggression. Similarly, the Malayan Communist Party and the British Empire agreed a truce for the Malayan Campaign and subsequent Japanese Occupation.

Cold War
The doctrine was also used extensively during the Cold War between Western Bloc nations and the Soviet Union. The Soviets and the Chinese aided North Korea during the Korean War as well as the Viet Cong/North Vietnamese during the Vietnam War to oppose American foreign policy goals. Likewise, the United States and its allies supported the Afghan Mujahideen after the Soviet invasion in the hopes of thwarting the spread of Communism. In the Third World, both superpowers supported regimes whose values were at odds with the ideals espoused by their governments. These ideals were capitalism and liberal democracy in the case of the United States, and the Marxist–Leninist interpretation of Communism and proletarian democracy in the case of the Soviet Union. In order to oppose the spread of Communism, the United States government supported dictatorial regimes, such as Mobutu Sese Seko in Zaire, Suharto in Indonesia, and Augusto Pinochet in Chile.

The support provided by the Soviet Union towards nations with overtly anti-Communist governments, such as Gamal Abdul Nasser in Egypt, in order to oppose American influence, is another example of "the enemy of my enemy is my friend" as policy on an international scale. The Soviets also backed India to counter both the pro-American Pakistani government and the People's Republic of China (following the Sino-Soviet split), despite the fact that India had a democratic government. Similarly, China, following the split, lent support to nations and factions that embraced an anti-Soviet, often Maoist form of Communism, but whose governments nonetheless embraced Sinophobic policies at home, such as the Khmer Rouge-ruled regime of Democratic Kampuchea.

Middle East
In an example of this doctrine at work in Middle Eastern foreign policy, United States backed the Iraqi government under Saddam Hussein during the Iran–Iraq War, as a strategic response to the anti-American Iranian Revolution of 1979. A 2001 study of international relations in the Middle East used the proverb as the basis of its main thesis, examining how enmity between adverse nations evolve and alliances develop in response to common threats.

Balance theory
In mathematical sociology a signed graph may be used to represent a social network that may or may not be balanced, depending upon the signs found along cycles. Fritz Heider considered a pair of friends with a common enemy as a balanced triangle. The full spectrum of changes induced by unbalanced networks was described by Anatol Rapoport:
 * The hypothesis implies roughly that attitudes of the group members will tend to change in such a way that one's friends' friends will tend to become one's friends and one's enemies' enemies also one's friends, and one's enemies' friends and one's friends' enemies will tend to become one's enemies, and moreover, that these changes tend to operate even across several removes (one's friends' friends' enemies' enemies tend become friends by an iterative process).

Frank Harary described how balance theory can predict coalition formation in international relations:
 * One can draw the signed graph of a given state of events and examine it for balance. If it is balanced there will be a tendency for the status quo. If it is not balanced, one should question each of the bonds between pairs of nations in a cycle with regard to relative strength in the situation. One might then predict that the weakest such bond will change sign.

Harary illustrated the method as a gloss on some events in the Middle East using several signed graphs, one of which represented eight nations.

In popular culture
In Desperate Housewives, season 2, episode 2, Danny Farrell was a paperboy who remarkably became the enemy of every woman on Wisteria Lane. If there was a puddle on someone’s property, he found it. If a new rose bush had just been planted, he destroyed it. If a cat was enjoying a moment in the sun, he ended it. After verbally accosting Susan Mayer one day, he was thrown from his bicycle when she hurled her paper through his spokes. When the women of Wisteria Lane witnessed this, Mary Alice Young remarks, “Yes, the women of Wisteria Lane believed Danny Farrell to be the enemy. They also believed the enemy of my enemy is my friend,” as Ida Greenberg flashes Susan a thumbs up.

In The Office season six episode "Koi Pond", Dwight Schrute has a line that causes an infinite loop of contradictions: "Jim is my enemy. But it turns out that Jim is also his own worst enemy. And the enemy of my enemy is my friend. So Jim, is actually my friend. But, because he is his own worst enemy, the enemy of my friend is my enemy so actually Jim is my enemy. But..." and he got stuck in the loop until he realized to get out.

In "Face Off", the season four finale of AMC crime drama Breaking Bad, Walter White works with Hector Salamanca, a member of the rival Salamanca crime family, to kill drug lord Gustavo Fring, an enemy common to both of them.

In Mass Effect, the character Wrex says that his people have a saying: "Seek the enemy of your enemy and you will find a friend".

In Alien vs Predator, archaeologist Sebastian De Rosa says the line when he and Lex Woods learn about the conflict between the Predators and Aliens and decide to help the Predators destroy the Aliens in order to stop them from escaping the underground pyramid.

In Transformers: Age of Extinction, Harold Attinger says the line during last meeting with Lockdown on his ship.

In Star Trek Into Darkness, Kirk says the line when he's planning to team up with Khan to defeat Admiral Marcus, a common enemy who kept Khan's crew captive to coerce Khan into building weapons for him and threatened to destroy Kirk's crew after Kirk discovers his conspiracy and rebels against him.

In Season 1, Episode 6 of "Ahsoka", Baylan Skoll says to his trainee, Shin Hati, "The enemy of my enemy is my friend. At least for now." After spotting bandits on a nearby ridge, overlooking a recent skirmish.

In the 16th campaign mission of the video game Modern Warfare 2, Captain John Price contacts mercenary terrorist Vladimir Makarov, references the adage to extract information as to the whereabouts of their common enemy and the hidden antagonist, General Shepherd. Before handing over said information, Makarov retorts the saying, warning, "Price, one day you're going to find that cuts both ways."