After dismissing al-Bakr in 1979, Saddam officially succeeded him as the fifth President of Iraq, Chairman of the Revolutionary Command Council, as well as Prime Minister and General Secretary of the Regional Command of the Ba'ath Party. Saddam's seizure of power occurred during a wave of anti-government protests in Iraq, which were led by Shias. The Ba'ath Party, which was officially secular in nature, harshly repressed the protests. Another policy change during this time was in Iraq's foreign policy towards Iran, a Shia-majority country which had recently undergone a major revolution that ousted the Shah, Mohammed Reza Pahlavi, and established a theocratic Islamic state led by the Shia clergy with Ruhollah Khomeini serving as its Supreme Leader. Rapidly deteriorating relations eventually led to the Iran–Iraq War by 1980, which began following the Iraqi invasion of Iran in September 1980. After the 1979 Islamic Revolution, the Iraqi leadership believed that the post-revolutionary chaos had caused the Iranians to be militarily weak, and thus a relatively easy target for the Iraqi military, which had until this point struggled to combat Iranian forces under the Shah. This notion proved to be incorrect, and the war lasted for eight years. The economy of Iraq deteriorated during this period, and the country became dependent on foreign loans to fund its war effort. The conflict ended in a stalemate when a United Nations Security Council-mandated ceasefire was accepted by both sides in 1988, which resulted in a "status quo ante bellum".