United States foreign policy in the Middle East has its roots in the 18th century Barbary Wars in the first years of the United States of America's existence, but became much more expansive in the aftermath of World War II. American policy during the Cold War tried to prevent Soviet Union influence by supporting anti-communist regimes and backing Israel against Soviet-sponsored Arab countries. The U.S. also came to replace the United Kingdom as the main security patron of the Persian Gulf states in the 1960s and 1970s, to ensure a stable flow of Gulf oil. The U.S. has diplomatic relations with all countries in the Middle East except for Iran, whose 1979 revolution against the US-backed reign of Shah Mohammad Reza Pahlavi brought to power a staunchly anti-American government.