|A former president, Rafsanjani has been a vocal critic of Ahmadinejad [EPA]
Iranians have taken to the streets in the wake of the country's disputed elections, but behind the public face of the election protests lies a deeper power struggle.
In the corridors of power, analysts see a battle between Ayatollah Ali Khamenei, Iran's supreme leader, and Akbar Hashemi Rafsanjani, the reformist former president.
Khamenei had publicly endorsed Mahmoud Ahmadeinejad, the incumbent president, whose resounding election victory over Mir Hossein Mousavi, his main rival, prompted a wave of protests and allegations of voter fraud.
Rafsanjani, on the other hand, has been a vocal critic of the president.
One of Iran's richest men, Rafsanjani, like Mousavi, is also one of the old guard of the 1979 Iranian revolution.
"It [the election dispute] represents the conflict between two schools of thought in Iran," Mahjoob Zweiri, a professor in Middle East politics at the University of Jordan, told Al Jazeera.
"The first one, which is represented by the supreme leader, says Iran should stay a revolutionary state, and Akbar Hashemi Rafsanjani wants the state to move on - to become a modern state, a pragmatic state.
"This is actually the root of the conflict we are seeing in the streets of Tehran.
"I think the support which Mousavi has been seeing from Akbar Hashemi Rafsanjani is because Mousavi agrees with Rafsanjani on that principle."
Iran's shadowy political machinations spilled out of the corridors of power and into view in a television debate ahead of the elections.
Ahmadinejad said that Mir Hossein Mousavi, his opponent, was backed by politicians who he said were corrupt, and named Rafsanjani.
Infuriated, Rafsanjani wrote a public letter to Khamenei, accusing the Supreme Leader of remaining silent in the face of such accusations.
"If the system cannot or does not want to confront such ugly and sin-infected phenomena as insults, lies and false allegations made in that debate, how can we consider ourselves followers of the sacred Islamic system," he charged in his letter.
It was a rare and unusual public rebuke of Khamenei.
The supreme leader's decision-making powers are said to be absolute, but Iran's Assembly of Experts also wield considerable political clout.
Rafsanjani is chairman of the 86-member body, which appoints the supreme leader and monitors his performance.
It seems unlikely that Rafsanjani would move to oust Khamenei, but the assembly could - in theory, at least - remove the supreme leader from office, if his actions are deemed un-Islamic or if he is unable to carry out his sworn duties.
With the street protests putting pressure on Iran's political leaders, it was rumoured that Rafsanjani and Hassan Rohani, Iran's former chief nuclear negotiator, were in the city of Qom, seeking a meeting of the assembly.
Khamenei's surprise decision to ask the 12-member Guardian Council to investigate the alleged election improprieties has suggested to many he is feeling the pressure.