Despite economical growth, there was much opposition against the Mohammad Reza Shah, and how he used the secret police, the Savak, to control the country. Strong Shi'i opposition against the Shah, and the country came close to a situation of civil war. The opposition was lead by Ayatollah Khomeini, who lived in exile in Iraq and later in France. His message was distributed through music cassettes, which were smuggled into Iran in small numbers, and then duplicated, and spread all around the country. This was the beginning of Iranian revolution.
On January 16 1979, the Shah left Iran. Shapour Bakhtiar as his new prime minister with the help of Supreme Army Councils couldn't control the situation in the country anymore.
Ayatollah Khomeini returned to Iran on February 1. Ten days later Bakhtiar went into hiding, eventually to find exile in Paris. Processes against the supporters of the Shah started, and hundreds were executed.
On April 1, after a landslide victory in a national referendum in which only one choice was offered (Islamic Republic: Yes or No), Ayatollah Khomeini declared an Islamic republic with a new Constitution reflecting his ideals of Islamic government.
Ayatollah Khomeini became supreme spiritual leader (Valy-e-Faqih) of Iran. Subsequently many demonstrations were held in protest to the new rules, like extreme regulations on women's code of dress.
On November 4: Iranian Islamic Students stormed the US embassy, taking 66 people, the majority Americans, as hostages. 14 were released before the end of November. In November: The republic's first Prime Minister Mehdi Bazargan resigned.
In 1980 Abolhassan Beni Sadr was elected for president.
On September 22: Iraq massively invaded Iran, in the belief that Iran is too weak military to fight back. Iraq was claiming territories inhabited by Arabs (Southwestern oil-producing province of Iran called Khouzestan), as well as Iraq's right over Shatt el-Arab (Arvandroud). Some battles were won in the favor of Iraq, but a supposedly weakened Iranian army achieved surprising defensive success.
In 1981, on January 20, the hostages in the US embassy were released, after long negotiations, where USA concedes to transfer money, as well as export military equipment to Iran.
In June, Beni Sadr was removed from power by Ayatollah Khomeini, and fleed to France in July. Former prime minister Mohammad Ali Rajai was elected president.
In August 30, President Rajai and his prime minister were killed in a bombing.
Khamenei was one of the founders of the Islamic Republican Party, which dominated the Majlis (the national legislature) after the 1979 revolution. He was appointed to the Council of the Islamic Revolution in 1979, and between 1979 and 1981 he was a member of the Majlis, serving as deputy minister of defense, commander of the Revolutionary Guard, and representative on the Supreme Council of Defense. He also served several times as general secretary of the Islamic Republic Party.
By summer of 1982, Iraq's initial territorial gains had been recaptured by Iranian troops that were stiffened with Revolutionary Guards. The Iraqi forces were driven out of Iran. The war extended to shooting of boats in the Persian Gulf, in an attempt to hurt the other country's oil exports. As required by the constitution, he resigned the presidency in 1989.
On 20 August 1988, a cease fire was signed between Iran and Iraq. Both parties accepted UN Resolution 598.
Following Ayatollah Khomeini's death on 3 June 1989 of a heart attack, Khamenei assumed the role of supreme spiritual leader. The Assembly of Experts (Ulama) met in emergency session on June 4 and elected President Khamenei the new Valy-e-Faqih (supreme spiritual leader), simultaneously promoting him to the status of ayatollah. And Hojatoleslam Ali Akbar Hashemi Rafsanjani, speaker of the Majles (parliament) was elected as a president.
He graduated in the late 1950s as a Hojatoleslam, a Shiite clerical rank just below that of ayatollah. Opposed, like his mentor, to the rule of Mohammad Reza Shah Pahlavi, Rafsanjani became the exiled Khomeini's chief agent in Iran, was arrested on several occasions, and spent three years in prison (1975-1977) for his activities.
In 1990-1991 Iran condemned both Iraq's invasion in Kuwait and the allied forces actions against Iraq.
Rafsanjani was re-elected in 1993 but stepped down in 1997, since the Iranian constitution limits the president from seeking a third term. From 1995 was total ban on trade with Iran by USA.
In 1997 Hojatoleslam Mohammad Khatami was elected president by gaining almost 70 percent of the votes cast. He pursued political reform and opposed censorship. He is considered to be reformist towards democratization of Iran's society and willing to normalize the relation with west and reduce tensions in the region.
Although popular among much of the Iranian public, these policies met considerable opposition from conservatives who controlled the legislature and judiciary.
Hojatoleslam Mohammad Khatami was again re-elected as president in 2001 election by greater mandate of Iranian people (almost 78% of the vote cast).
On 24 June 2005 Dr. Mahmoud Ahmadinejad was elected as Iran's sixth president. He swept to the presidential post with a stunning 17,046,441 votes out of a total of 27,536,069 votes cast in the runoff election.