TEHRAN, Iran (CNN) -- There was a smile, a quick wave hello, a brief chat. Yet, despite the exchange of pleasantries, the simmering tensions between Iranian President Mahmoud Ahmadinejad and one of the nation's most powerful clerics became quickly evident at a major ceremony in Tehran on Monday.
From left: former President Ali Akbar Hashemi Rafsanjani, Sadeq Larijani and President Mahmoud Ahmadinejad.
Ahmadinejad and former President Ali Akbar Hashemi Rafsanjani were attending the inauguration of Sadeq Larijani -- brother of Iran's prominent parliamentary speaker, Ali Larijani -- who was tapped by Iran's supreme leader to be the new judiciary chief.
It was only the second time Ahmadinejad and his political rival Rafsanjani, a reformist who has been a vocal critic of the hard-line regime in place, sat under the same roof since the disputed June 12 elections drew a rift among Iran's Islamic leadership, Iranian media reported.
Photos from the scene show Ahmadinejad exchanging friendly waves with Rafsanjani and Sadeq Larijani, who was wedged between the rivals. The three appeared to be chatting amicably before Larijani made his acceptance speech.
Just minutes later, Ahmadinejad alluded to Rafsanjani, one of the richest men in Iran, in a searing address that called for the prosecution of "the power-holders and the wealthy," state-run Press TV reported.
But the president, who showed up more than an hour late for the ceremony, hustled out of the ceremony when Rafsanjani, the head of the Assembly of Experts that is in charge of selecting the supreme leader, took the podium, according to the Iranian Labour News Agency (ILNA), which is aligned with Rafsanjani.
The bad blood between the two high-profile figures goes back to the 2005 presidential race, when Ahmadinejad defeated Rafsanjani. This time around, Rafsanjani supported Ahmadinejad's chief rival, opposition leader Mir Hossein Moussavi, in the race.
Iran's election authority declared Ahmadinejad the overwhelming winner of the race, sparking hundreds of thousands of Iranians to take to the streets in protest. While hundreds have been released, the Islamic government has been prosecuting opposition figures en masse.
Supporters of the trials have focused their rhetoric on Moussavi, fellow reformist Mehdi Karrubi and Rafsanjani, accusing the leaders of instigating post-election unrest and calling for charges against them.
During his speech at Sadeq Larijani's inauguration Monday, Rafsanjani warned against the consequences of "unjust" verdicts in the trials, saying poor treatment of the detainees will cause society to "descend into chaos," Press TV reported
"In the case of delivering fair verdicts, society will have a sense of security," Rafsanjani said, according to Press TV, "and no one will feel helpless in asserting his violated rights."
The treatment of detainees at Iran's prisons has increasingly become a divisive issue within Iran's Islamic leadership, as reformists continue to accuse the government of allowing abuse and torture in attempts to coerce false confessions.
The newly appointed judiciary chief admitted to deficiencies in the judicial system and pledged to prosecute those who "violated people's rights," Press TV reported.