When Mahmoud Ahmadinejad was publicly slammed by Iran's religious clerics for hugging the mother of Venezuelan President Hugo Chavez at his funeral and predicting he would rise again like Jesus Christ and the Hidden Imam, the outside world got a glimpse at the internal political tensions brewing inside the country.
The pounding criticism against the Iranian president included a rebuke from Iran's former judiciary chief Ayatollah Mohammad Yazdi, who referred to Ahmadinejad's action as "clowning around" and said he failed to "protect the dignity of his nation and his position."
But the rebuke may also indicate the fear the clerical establishment has of Ahmadinejad's political power and its reach in the upcoming elections set for June. While Ahmadinejad cannot run for a third term, the president is hoping a hand-picked successor will be able to take his place.
"All these things that he does are now fiercely criticized because his enemies are trying to marginalize him and his faction to a good degree that no candidate will be approved from his political faction to run for president," said Geneive Abdo, an expert on Iranian domestic politics and a fellow at the Stimson Center public policy institute, based in Washington, D.C. "They want him out of politics. They want his cronies out of politics. They don't want to deal with him anymore."
'His greatest foes are in Tehran'
Although more generally known for his rhetoric battles with the U.S or Israel, "his greatest foes are in Tehran," Abdo said.
Michael Nayebi, a Middle East analyst at the Texas geopolitical intelligence firm Stratfor, said the Chavez incident was just the "latest in a string of statements against Ahmadinejad that we've seen week after week, month after month over the past year."
Nayebi added that the clerics must perceive him as some kind of political threat, or "I don't think we'd see this continued vitriol that we do."
As Iran's first non-clerical president since the death of the Islamic Republic's founder Ayatollah Ruhollah Khomeini, Ahmadinejad has never been a favourite of the Ayatollahs, even though he had the backing of Iran's current Supreme Leader Ayatollah Ali Khamenei.
Abdo described Ahmadinejad as a "nationalist reactionary" and reflective of a generation, now in powerful positions, who were shaped by their experiences in the Iran/Iraq war.
"This generation, they're religious but not in a classical sense. They're very religious, very anti-American but they're extremists and they use their religiosity to political ends and this is what the clerics don't like."
Different interpretation of Islam
Part of the tension between Ahmadinejad and the clerics, who hold most of the power in Iran, is religious, and a differing interpretation of Islam, said Abdo.
"What the clerics despise most about Ahmadinejad is that he has a very heretical view of one of the most important theological concepts in Shia Islam," she said.
But they also have a dim view of some of his heated political rhetoric, including provocative statements he's made in the past about Israel, she said.
"The clerics do not agree with this inflammatory language," she said. "They're not radicals and they don't want the political leader of Iran to put the country in harm's way with all of this kind of rhetoric. That doesn't mean they have a love for Israel. But it's one thing to be in some sort of Cold War situation with Israel and another thing to provoke the Israelis to the point of them launching an attack on Iran."
Ahmadinejad has taken a number of opportunities to take subtle swipes at the clerics, including Khamenei, questioning in public for example whether their edicts are directives or suggestions. He has also tried to consolidate more power for the presidency, trying to create a parallel foreign ministry and by making political appointments he's not entitled to make.
"He's struck out on his own in a lot of ways," Nayebi said. "He doesn't necessarily think that he's got to toe the Supreme Leader's line. He [thinks he] can do what he wants."
His actions have forced Khamenei to publicly distance himself from the president. In 2010, Khamenei visited the clerics in Iran's holy city of Qom to ensure his own base within was intact "because he had this problem child that he's been supporting, that he nurtured that he elevated to the presidency," Abdo said. "He has had to pay a big political price for that."
While the clerics do their best to discredit him, Ahmadinejad's battles with the religious establishment have endeared him to many Iranians.
"One of Ahmadinejad's driving message is that the clerics are out of touch, they're corrupt, why are they in charge of everything? His actions express these questions on the street," Nayebi said.
So when he hugs the mother of a deceased friend, the public relates more to him than the clerics who admonish his actions, Nayebi said.
"He's a very astute politician," Nayebi said. "He knows how to set off these clerical elites and how to react in the goofy sense, and he always ends up looking better."
Nayebi said that Ahmadinejad is trying to leverage public support to get the clerical establishment, which decides who can run in the election, to approve of his favoured candidate.
But, as Nayebi recently wrote in article for Stratfor, there are also no guarantees that Ahmadinejad's popularity will transfer to a chosen successor.
"As Western-backed sanctions exacerbate economic difficulties in Iran, another political figure may well try to buy the support of the masses with a new subsidy regime, undermining Ahmadinejad's populist policies," Nayebi wrote. "What we can see, however, is an ongoing reaction by the clerical establishment against Ahmadinejad's presidency."