The outbreak of the Iran–Iraq War in September, 1980 provided the Soviets with a quandary since they aimed to be friends with both sides. The 1979 Iranian revolution had overthrown the Shah, the USA's key ally in the Middle East. Iran's new anti-American stance presented the USSR with a golden opportunity to win the country over to the Soviet camp. But the war between Iraq and Iran complicated matters. Iraq had been a very close ally of the Soviets since 1958 and in 1972, the USSR and Iraq had signed a Treaty of Friendship and Cooperation in which both countries promised to help each other under threat and to avoid entering hostile alliances against one another. Iraq, along Syria and PLO, had replaced Egypt as the Soviets' chief ally in the region after Egyptian President Anwar Sadat aligned with USA, and recognized Israel in 1977 and made a peace treaty in 1979 . In 1967, Iraq signed an agreement with the USSR to supply the nation with oil in exchange for large-scale access to Eastern Bloc arms. The Soviets were unhappy with Iraq's offensive against Iran, although they avoided issuing an official condemnation. They were reluctant to supply Iraq with more arms although they allowed their Warsaw Pact allies to continue doing so. At the same time, the USSR attempted to court Iran and offered to sell arms to the Iranians, a bid for friendship which was rejected by Tehran, due to its historic distrust of Russia and the Soviet Union. Nevertheless, the USSR's allies, Libya and Syria, sold weapons to the Iranians, presumably with Soviet permission. The Soviets also worried what Western reaction would be if they opted to back either Iraq or Iran. The complicated balancing act of trying to maintain good relations with both Iran and Iraq led the USSR to observe a policy of "strict neutrality" during the opening phase of the war while calling for a negotiated peace.