In the spring of 1979, Iran's Shah Mohammad Reza Pahlavi was ousted from power and the exiled Shi'a cleric Ayatollah Ruhollah Khomeini returned to take control of a new form of government in this ancient land.
On April 1, 1979, the Kingdom of Iran became the Islamic Republic of Iran after a national referendum. The new theocratic government structure was complex, and included a mixture of elected and unelected officials.
Who is who in Iran's government? How does this government function?
The Supreme Leader
At the apex of Iran's government stands the Supreme Leader. As head of state he has broad powers, including command of the armed forces, appointment of the head of the judiciary and of half of the Guardian Council's members, and confirmation of presidential election results.
However, the Supreme Leader's power is not entirely unchecked. He is selected by the Assembly of Experts, and could even be recalled by them (although this has never actually happened.)
So far, Iran has had two Supreme Leaders: the Ayatollah Khomeini, 1979-1989, and the Ayatollah Ali Khamenei, 1989-present.
The Guardian Council
One of the most powerful forces in Iran's government is the Guardian Council, which consists of twelve top Shi'a clerics. Six of the council members are appointed by the Supreme Leader, while the remaining six are nominated by the judiciary and then approved by the parliament.
The Guardian Council has the power to veto any bill passed by parliament if it is judged inconsistent with the Iranian Constitution or with Islamic law. All bills must be approved by the council before they become law.
Another important function of the Guardian Council is the approval of potential presidential candidates. The highly conservative council generally blocks most reformists and all women from running.
The Assembly of Experts
Unlike the Supreme Leader and the Guardian Council, the Assembly of Experts is directly elected by the people of Iran. The assembly has 86 members, all clerics, who are elected for eight-year terms. Candidates for the assembly are vetted by the Guardian Council.
The Assembly of Experts is responsible for appointing the Supreme Leader and supervising his performance. In theory, the assembly could even remove a Supreme Leader from office.
Officially based in Qom, Iran's holiest city, the assembly often actually meets in Tehran or Mashhad.
Under the Iranian Constitution, the President is head of the government. He is charged with implementing the constitution, and managing domestic policy. However, the Supreme Leader controls the armed forces and makes major security and foreign policy decisions, so the power of the presidency is rather sharply curtailed.
The president is elected directly by the people of Iran for a four-year term. He can serve no more than two consecutive terms, but can be elected again after a break. That is to say, for example, that a single politician could be elected in 2005, 2009, not in 2013, but then again in 2017.
The Guardian Council vets all potential presidential candidates, and usually rejects most reformers and all women.
The Majlis - Iran's Parliament
Iran's unicameral parliament, called the Majlis, has 290 members. (The name literally means "place of sitting" in Arabic.) Members are directly elected every four years, but again the Guardian Council vets all candidates.
The Majlis writes and votes on bills. Before any law is enacted, however, it must be approved by the Guardian Council.
Parliament also approves the national budget and ratifies international treaties. In addition, the Majlis has the authority to impeach the president or cabinet members.
The Expediency Council
Created in 1988, the Expediency Council is supposed to resolve conflicts over legislation between the Majlis and the Guardian Council.
The Expediency Council is considered an advisory board for the Supreme Leader, who appoints its 20-30 members from among both religious and political circles. Members serve for five years, and may be reappointed indefinitely.
The President of Iran nominates the 24 members of the Cabinet, or Council of Ministers. Parliament then approves or rejects the appointments; it also has the ability to impeach the ministers.
The first vice-president chairs the cabinet. Individual ministers are responsible for specific topics such as Commerce, Education, Justice, and Petroleum Supervision.
The Iranian judiciary ensures that all laws passed by the Majlis conform with Islamic law (sharia), and that the law is enforced according to the principles of sharia.
The judiciary also selects six of the twelve members of the Guardian Council, who then must be approved by the Majlis. (The other six are appointed by the Supreme Leader.)
The Supreme Leader also appoints the Head of the Judiciary, who selects the Chief Supreme Count Justice and the Chief Public Prosecutor.
There are several different types of lower courts, including public courts for ordinary criminal and civil cases; revolutionary courts, for national security matters (decided without provision for appeal); and the Special Clerical Court, which acts independently in matters of alleged crimes by clerics, and is overseen personally by the Supreme Leader.
The Armed Forces
A final piece of the Iranian governmental puzzle is the Armed Forces.
Iran has a regular army, air force and navy, plus the Revolutionary Guard Corps (or Sepah), which is in charge of internal security.
The regular armed forces include approximately 800,000 troops total in all branches. The Revolutionary Guard has an estimated 125,000 troops, plus control over the Basij militia, which has members in every town in Iran. Although the exact number of Basij is unknown, it is probably between 400,000 and several million.
The Supreme Leader is Commander-in-Chief of the military, and appoints all top commanders.
Due to its intricate set of checks and balances, the Iranian government can get bogged down in times of crisis. It includes a volatile mix of elected and appointed career politicians and Shi'a clerics, from ultra-conservative to reformist.
Altogether, Iran's leadership is a fascinating case study in hybrid government - and the only functioning theocratic government on Earth today.