since the 1979 Islamic revolution, with deadly street protests, a raft of political trials and an escalating feud between rival factions.
Ahmadinejad, 52, is himself under fire from his own hardline camp, which questions his loyalty to supreme leader Ayatollah Ali Khamenei.
The announcement of Ahmadinejad's landslide victory in the June 12 presidential vote was met with an outpouring of anger from opposition supporters, who claim their votes were stolen.
Massive street protests that erupted in the wake of the announcement left at least 30 people dead and saw several thousand protesters rounded up, among them prominent pro-reform figures and journalists.
Mir Hossein Mousavi and Mehdi Karroubi, who stood against Ahmadinejad in the election, have accused the authorities of massive vote rigging and have branded Ahmadinejad's presidency as illegitimate, in flagrant defiance of Khamenei.
Ahmadinejad's re-election has also created a rift among the country's clergy, with several senior clerics siding with the opposition and condemning the post-election violence and the regime's treatment of its critics.
The authorities have hit back with a heavy-handed crackdown on protesters, whom they accuse of seeking to overthrow the regime.
On Saturday, around 100 moderates and reformists were put on trial in a revolutionary court in Tehran, a move slammed by opposition leaders but welcomed by hardliners. Another 10 went on trial on Sunday.
In a keynote speech on June 19 after a week of bitter protests, Khamenei strongly backed Ahmadinejad and dismissed the allegations of vote rigging.
Khamenei is expected to confirm Ahmadinejad's presidency on Monday, two days before the hardliner takes the oath.
The all-powerful leader has also accused Western governments, Britain in particular, of instigating the post-election unrest.
London dismissed the allegation and tension between the two countries deepened after Iran detained nine local British embassy staffers on accusations of provoking riots. All have since been released.
Iran's relations with the West worsened during Ahmadinejad's first term because of his frequent verbal attacks on Israel and his uncompromising stance on Tehran's controversial nuclear programme, which world powers fear is a cover for weapons development.
Although key policy issues are decided by Khamenei, critics point the finger of blame directly at Ahmadinejad for three sets of UN Security Council sanctions against Iran over its refusal to suspend uranium enrichment.
Opponents also accuse Ahmadinejad, who enjoyed windfall oil revenues in his first term, of mismanaging the economy, stoking inflation, wasting resources and manipulating statistics to cover his failures.
Ahmadinejad, who enjoyed Khamenei's support throughout his first term, crossed swords with the supreme leader after he appointed a controversial aide as his first vice president.
Khamenei intervened and ordered the sacking of Esfandiar Rahim Mashaie, an outspoken politician who last year enraged hardliners by saying Iran was a friend of Israeli people.
The fact that it took Ahmadinejad a week to finally carry out Khamanei's order angered the conservative wing of the regime, who warned him to obey the supreme leader.
The hardline camp was further irked when Ahmadinejad sacked intelligence minister Gholam Hossein Mohseni Ejeie following a reported "quarrel" over Rahim Mashaie's appointment.
Ahmadinejad has denied any rift with Khamenei and has characterised his relationship with the supreme leader as that of "father and son."
Iran's crackdown on protesters drew international condemnation, including from arch-foe the United States.
After three decades of severed diplomatic ties, Washington earlier this year made overtures to Tehran, offering talks
over their long-standing disputes, including the nuclear issue.
Iran has yet to respond to the offer but has ruled out negotiations over the nuclear programme, insisting the atomic work is for solely peaceful ends.
Should Ahmadinejad stick to his guns on the nuclear programme, his second term is likely to be characterised by greater tension with the West, which has warned of even tougher sanctions.
Iran's stance towards close US ally Israel is also likely to harden further with Ahmadinejad -- who has repeatedly said the Jewish state is doomed to disappear -- at the helm for a further four years.
Israel, the Middle East's sole if undeclared nuclear power, has stressed that it holds a military option to curb Tehran's atomic ambitions.