(CNN) -- Four years ago, Supreme Leader Ayatollah Ali Khamenei kissed Mahmoud Ahmadinejad on the cheek before he was sworn in as Iran's new leader.
Mahmoud Ahmadinejad could be in for a rocky second term as Iranian president, analysts say.
Song and prayer heralded a new start for Iran with the hard-line Tehran mayor, virtually unknown to the outside world in 2005. He promised to stamp out corruption and fight for justice.
With time, the world came to know the Iranian leader with his signature beige jacket and combative -- often anti-Israeli -- rhetoric.
Monday, Iran's supreme leader endorsed Ahmadinejad for a second term in office, but there was no hug or kiss this time around. Video from the event shows Ahmadinejad leaning toward Khamenei before the supreme leader raises his left hand to block him, leaving Ahmadinejad to gingerly kiss the cleric's robe.
The awkward scene seemed to only bolster the tensions that have emerged in the once strong relationship.
Under Iran's constitution, the incoming president must receive the supreme leader's approval before being sworn into office. Khamenei's endorsement is the first step in that process.
On Wednesday, Ahmadinejad will take the oath of office before Parliament. But he will begin his second term in a deeply fractured Iran, one in which the conservative leader finds himself under assault from the legions of pro-democracy supporters and the nation's powerful clerical establishment.
Given the unprecedented fissures in Iranian society, some longtime scholars and observers now doubt whether Ahmadinejad will finish his second term in office. Some question whether the clerical establishment will sacrifice him in order to save the Islamic republic.
Ahmadinejad's main political problem is "legitimacy," said Alex Vatanka, senior Middle East analyst at IHS Jane's, a provider of defense and security information.
"Can you operate for four years with huge questions over whether you are the rightful president?" Vatanka said. "I think that would undermine everything he does."
Ahmadinejad was declared the winner of Iran's June 12 election, but thousands took to the streets in the aftermath to protest what they believed was a rigged vote. They chanted the name of Ahmadinejad's chief rival, reformist Mir Hossein Moussavi, the crowds a sea of green, the color of the opposition candidate's campaign.
Since then, widespread demonstrations have plagued Iran's leaders, who have ordered security forces to crack down swiftly and violently. Iranians have been arrested and jailed, their treatment condemned by global human rights organizations such as Amnesty International.
Khamenei stood by his president, but strains in the relationship have surfaced in recent days after Ahmadinejad refused at first to heed the supreme leader's orders to change a controversial vice-presidential pick.
Iran's clerics have made it known they would like Ahmadinejad "to remain a powerful and popular president" and reminded Iran that the supreme leader's word is the last one in the Islamic Republic.
On the eve of his inauguration, Ahmadinejad sought to downplay any rift. In a public address, he compared his relationship with Khamenei to that of a father and son.
But Kazem Alamdari, lecturer in sociology at California State University, Northridge, said Ahmadinejad has alienated the clerics just as he has the reformists.
Alamdari said Ahmadinejad risks losing conservative supporters who may feel that Iran's system has been placed in danger and that the situation has "created an atmosphere for external forces to attack Iran."
If convinced the system is truly threatened, Khamenei could use his power to dismiss Ahmadinejad, Alamdari said. It wouldn't be the first time a supreme leader has made such a move.
The Islamic Society of Engineers, a conservative group and ally of Ahmadinejad, in a statement warned that he could suffer the same fate as Prime Minister Mohammad Mossadeq. He lost the support of the clerics, consequently the people, and eventually was deposed in a 1953 CIA-backed coup.
Iran's first president after the 1979 Islamic revolution, Abolhassan Bani-Sadr, was forced to flee the country after he stood against the clerics, including then-Supreme Leader Ayatollah Ruhollah Khomeini.
The Islamic Society of Engineers statement asked Ahmadinejad for "absolute obedience of the supreme leader."
Adding to Ahmadinejad's political worries is a faltering economy.
The world may have viewed Iran's June 12 vote through the prism of individual freedoms and nuclear weapons, but most Iranians paid close attention to a staggering inflation rate, double-digit unemployment and the expenditure of oil revenue. With oil prices plummeting to below $40 a barrel, the Iranian government may be facing unsustainable budget deficits.
Some analysts said the president's first-term economic mismanagement had already earned him the ire of the establishment, long before any controversy erupted over his political legitimacy.
One scholar, who is currently in Iran and did not want be identified for safety reasons, said it is increasingly clear the regime has not chalked out a perfect path to the future -- and how long Ahmadinejad will be along for the ride.
Vatanka said Ahmadinejad lacks the political mindset for consensus and collaboration. But what empowers him may be his belief in himself. And one other weapon: he thinks God is on his side.