Who really rules Iran?

Iran’s disputed election has revealed a Byzantine system of rule which makes it hard to understand who really wields power
Isn't the president the top dog?
He is the one who gets popularly elected, appoints cabinets and is answerable to Iran's elected parliament, or Majlis. Yet the Islamic Republic of Iran is not a constitutional democracy as Westerners understand the term. The president remains subservient to a set of institutions dominated by the clerical elite that surrounds Iran's enigmatic Supreme Leader – Grand Ayatollah Ali Khamenei. Iran's politics may be democratic in appearance but its key institutions are dedicated to safeguarding the Islamic revolution.
What is the Supreme Leader's role?
The revolutionary 1979 constitution gives him sweeping powers. Commander-in-chief of the armed forces, he can appoint and dismiss the chief of the general staff, and the heads of the army, navy, air force and Revolutionary Guard. He appoints the heads of Iran’s judiciary, the president of state radio and TV, the executives who supervise the nominally independent newspapers, and the leaders of Friday prayers who act as his mouthpieces at a local level. Ali Khamenei, appointed Supreme Leader after the death of Ayatollah Khomeini in 1989, now controls some 2,000 clerical commissars who permeate every bureaucracy and act as his enforcers, his eyes and ears. No wonder the Supreme Leader has been called "part pope, part commander-in-chief and one-man Supreme Court".
But is he really so supreme?
In theory he's constrained by the Assembly of Experts, an 86-member conclave of Islamic clerics comparable to the Vatican’s college of cardinals: they meet twice a year (usually in the holy city of Qom), monitor the Supreme Leader's performance and can remove him from office if he's seen to fail in his duties. In practice, they're less of an independent check on his power than they seem. True, they’re elected (for an eight-year term) by direct public vote. True also that the Assembly's deputy chairman is ex-president Akbar Hashemi Rafsanjani, one of Supreme Leader Khamenei's chief antagonists in the present crisis. But the Assembly is dominated by conservative clerics. And that is unsurprising, since eligibility for election to the Assembly is regulated by the 12 theologians on the Guardian Council, half of whose members are appointed by the Supreme Leader himself and half are nominated by the head of the judiciary (also a Supreme Leader appointee) and approved by parliament.
What does the Council do?
The most influential body in Iran, the Guardian Council not only has power to reject candidates for the Assembly; it also approves (or rejects) candidates for the presidency and parliament (before
these presidential elections it rejected all but four of around 4,000). Its approval must be sought for all laws introduced in parliament; it can veto any laws passed if these are “incompatible”
with Islamic law or the constitution. However, the Guardian

