Enemy of my enemy is my friend
An ancient proverb which suggests that two opposing parties can or should work together against a common enemy. The earliest known expression of the concept is found in the ancient Indian Sanskrit treatise on statecraft Arthashastra, which dates from around the 4th century BC, while the first recorded use of the current English version dates from the late 19th century.