Iran's political system - inherited from the Islamic revolution in 1979 - combines democratic and military forces checked by an overarching religious authority.
Analysts say the fact that Iran's government does not always speak with one voice makes negotiating the release of 15 British sailors and marines captured in disputed Gulf waters on 23 March such a difficult task. The main powers in Iran are:
SUPREME LEADER - AYATOLLAH ALI KHAMENEI
The Supreme Leader sits at the top of Iran's political power structure in a unique position based on ideas of the late revolutionary leader, Ayatollah Khomeini. He is chosen by clerics who make up the Assembly of Experts.
He appoints state officials such as the judiciary head, six members of the powerful Guardian Council, Friday prayer leaders and media chiefs. He also confirms the election of the president.
The leader appoints all military commanders, controls the armed forces and is entitled to make decisions on security, defence and major foreign policy issues.
PRESIDENT - MAHMOUD AHMADINEJAD
The president is chosen by direct election and is the second-highest ranking official in the country. He is head of the executive branch of power and responsible for ensuring implementation of the constitution.
In practice, his powers are circumscribed by clerics in Iran's power structure and the authority of the Supreme Leader.
A former Tehran mayor, Mr Ahmadinejad became president in 2005. His hardline anti-US and anti-Israeli opinions have captured international headlines, but his position has been undermined at home because he is seen as indulging in confrontational rhetoric at the expense of solving the country's problems.
SUPREME NATIONAL SECURITY COUNCIL
The national security council's job is to determine defence and security policy within the framework of general policies determined by the Supreme Leader.
Decisions by council - which include Iran's nuclear policy - come into force after confirmation by the Supreme Leader.
It is chaired by the president, who appoints the secretary, currently Ali Larijani, who was an unsuccessful candidate for the presidency in 2005. He fulfils a role as Iran's top international negotiator for matters related to defence and security.
The armed forces comprise the Islamic Revolutionary Guards Corps (IRGC) and the regular forces. The two bodies are under a joint general command. All leading army and Revolutionary Guard commanders are appointed by the Supreme Leader and are answerable only to him.
The Revolutionary Guard was formed after the revolution to protect the new leaders and institutions and to fight those opposing the revolution. It is also responsible for protecting Iran's land and maritime borders.
Analysts say it is unclear whether Ayatollah Khamenei gave the IRGC a green light to capture the UK military personnel in the Gulf or whether Guards commanders acting on their own initiative.
The Revolutionary Guard has a powerful presence in civilian institutions, and controls volunteer (Baseej) militias with branches in every town. It is thought elements of the Baseej have been advocating a hard line regarding the UK personnel, including putting them on trial.
The 290-seat Majlis, or parliament, is elected by popular vote. It has the power to introduce and pass laws, as well as to summon and impeach ministers or the president. However, all bills must be approved by the conservative Guardian Council.
The most influential body in Iran with power to approve or veto bills passed by parliament. It can also bar candidates from standing in elections to parliament, the presidency and the Assembly of Experts. In 2004, as a mark of conservative control of the electorial system, the council banned about half of candidates from running in parliamentary elections - almost all from the reformist camp. The council consists of six theologians appointed by the Supreme Leader and six jurists nominated by the judiciary and approved by parliament.
Assembly of Experts
This 86-member clerical body appoints the Supreme Leader, monitors his performance and can remove him if necessary. It is elected every eight years, but only clerics can stand and candidates are vetted by the Guardian Council.