(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.
Who is  Ahmadinejad? The leader must have the support of who to stay in office? What does the analyst say? Who protested the election result? Who is running for a second term as Iran president? What was  Ahmadinejad to be sworn in as? Who is slated to be sworn in?
Iran's new leader. the incoming president Mahmoud Ahmadinejad could be in for a rocky second term as Iranian president, thousands Mahmoud Ahmadinejad Iran's new leader. Mahmoud Ahmadinejad
question: Who is  Ahmadinejad?, answer: Iran's new leader. | question: The leader must have the support of who to stay in office?, answer: the incoming president | question: What does the analyst say?, answer: Mahmoud Ahmadinejad could be in for a rocky second term as Iranian president, | question: Who protested the election result?, answer: thousands | question: Who is running for a second term as Iran president?, answer: Mahmoud Ahmadinejad | question: What was  Ahmadinejad to be sworn in as?, answer: Iran's new leader. | question: Who is slated to be sworn in?, answer: Mahmoud Ahmadinejad