From the late 50s to the early 90s, Iraq was ruled by Abd al-Karim Qassim. Iraq was ruled as a Socialist and Soviet-aligned but not Communist state. Early in his reign, Iraq was unstable and there were multiple attempts to overthrow his government. He worked closely with the Iraqi Communist Party, but stopped short of fully embracing Communism. Iraq was beset by enemies, with the Western-aligned countries of Saudi Arabia, Israel, Jordan, and Iran (until 1978) in the neighborhood. Iraq’s main allies in the region would be Syria and Iran after 1978. The existence of a leftist Iraq was a cause for concern for across the region, and to make things worse in 1979 Iran went full red. In 1980 Iraq invaded and occupied Kuwait, with Qassim declaring the country to be a product of British Imperialism. In the early 80s, Saudi leadership and citizens worried that a godless Communists might march into Mecca soon.
But that never happened. America was quick to show its support for Saudi Arabia. Iraqi leadership understood that any attack on Saudi Arabia would invite American intervention. They had gotten lucky with Kuwait, but they knew not to push their luck again. In 1984, Iraq sent volunteers to Syria and launched missiles to help Syria in its war with Israel. Israel emerged victorious. As the 80s went on, the Soviet Union went into decline and the advance of Communism was halted. Instead of spreading Communism, the USSR found itself defending against anti-Communist rebellions, the costliest being in Iran. Iraq helped the Iranian government of Noureddin Kianouri against the Islamist rebels, though not to the same extent as the Soviet Union. Unlike Iran, Iraq was a stable country with a growing economy during the 1980s. Iraq would start to decline after Qassim’s death in 1992, however.
Throughout the 80s and early 90s all the major population centers were firmly under the Iranian government’s control. But the rural areas were often controlled by rebels. Soviet and pro-government Iranian troops were often ambushed while traveling between cities. When Gennady Yanayev assumed control of the Soviet Union, he ordered new offensives in Iran. Large swathes of land in South and Central Iran were back under government control, but at the price of high Soviet casualties. Iranian civilian casualties were also high, ensuring that the Soviet Union and its allies in Tehran were hated by Iran’s conservative Shia population even more than before. By 1993, it became clear that when the Soviets would leave a town in Iran’s interior, rebels would soon be back. In 1994, Soviet soldiers were pulled back from Central and Southwestern Iran and ordered to defend Iran’s Northern and Eastern provinces. The Soviet Union tried to broker a ceasefire between the two sides and failed. With the Soviet economy collapsing, all Soviet troops would be sent back home by the Spring of 1995.
Within weeks after the last Soviet soldiers left Iran, the rebels captured Bandar-E-Abbas. This gave them access to a port, making it easier for supplies to reach them. Within a year of the Soviet withdraw, Islamist rebels were in control of half the country. In 1997, the Iranian government finally came around to the idea of negotiating with the rebels. At the same time, Tehran was trying to move away from hardline Communism. These actions were denounced as revisionist by a faction within the ruling Tudeh Party, and there was an attempted coup. Meanwhile, the Summer on 1997 saw rapid rebel advances in Southeastern Iran, and border clashes with the Iraqi Army began. By 1998, Ahvaz and Mashad had fallen, and the Iranian Democratic Republic was limited to the Northeast.
Iranian government forces fought harder than anyone expected them to, delaying their inevitable defeat. Qom was captured in the Spring of 1998, but Tehran held out until April 1999. Communist forces continued fighting in Northeastern Iran for almost a year afterwards. An Islamist government led by Ali Khamenei and Akbar Rafsanjani was formed. Thousands of Communists and collaborators were arrested and hundreds executed. Islamist Iranian forces, now the official military of Iran, continued to be involved in border skirmishes with Iraq. In addition, some Shia militants went over the border to help the small but growing anti-government Shia groups operating in Iraq. The world watched with bated breath to see if these clashes would lead to all-out war between the two countries.