TEHRAN Two years ago, Iran's reformists were stunned to see him re-elected president and said the election must have been fixed.
Now, half way through his second and final term, Mahmoud Ahmadinejad has silenced the opposition -- their rallies crushed and leaders under house arrest -- but his presidency is still threatened, this time from rival fellow hardliners.
Critics in parliament, the judiciary and the clergy accuse the 54-year-old president of misdeeds ranging from a swaggering disrespect for other branches of government, through financial mismanagement, to being influenced by a "deviant" clique of aides some say are involved in sorcery.
Analysts say the fact that he can no longer rely on the complete support of Supreme Leader Ayatollah Ali Khamenei -- who forced him to reverse his decision to sack his intelligence minister in April -- means Ahmadinejad risks becoming a lame duck or even being forced out.
Some parliamentarians are threatening to impeach him.
But at a news conference earlier this week, a bespectacled Ahmadinejad looked in no mood to either quit or curb his populist, West-baiting agenda, promising to make good on a promise to create 2.5 million jobs this year and predicting once again that the "cancerous" Israel would be eradicated.
When asked about infighting, he answered: "Our position at the moment is to stay silent. An inspiring unity silence."
And asked about reports of arrests of figures close to his entourage, he said: "They arrested those people. Good for them.
"Now they should let us continue our job."
BREAD AND OIL
A key part of the president's job is steering the economy and Ahmadinejad says he has made progress where his predecessors were too timid and slashed the $100 billion in annual subsidies that the government used to pay to hold down prices.
Bread prices doubled and gasoline now costs up to seven times what it did six months ago, but forecasts of riots did not come true, allowing Ahmadinejad to declare victory for what he called "the biggest economic plan in the past 50 years."
"He has certainly pulled off a policy his predecessors couldn't politically," Farideh Farhi, an Iran expert at the University of Hawaii, said of the subsidy reform long advocated by Western economists at the IMF and World Bank.
"But the inflation risk remains high," she said.
Central Bank figures show the official rate of inflation has been rising steadily over the last year to 14.2 percent last month. Food inflation is around 25 percent. But many Iranians doubt the statistics and say real inflation is much higher.
Farhi said inflation was not just a concern for consumers, but also for industry whose input prices could soar.
"The real worry is a combination of increased inflation and increased unemployment as the factory owners' inability to adjust to higher prices lead to shutdowns and layoffs."
Inflation also contributes to pressure on the rial which the government has struggled to keep close to a peg with the dollar.
The Central Bank reduced the official dollar exchange rate by more than 10 percent this week, bringing it closer to the real price Iranians pay to buy dollars that many see as a safe haven in times of economic uncertainty.
Ever tighter international sanctions, aimed at forcing Iran to curb its nuclear program, have added strain to the economy.
But Ahmadinejad is benefitting from a spike in global oil prices that should insulate Iran from too much pain.
"It's difficult to determine the effects of major economic surgery when oil is over $100 a barrel," said Karim Sadjadpour, an associate at the Carnegie Endowment in Washington.
"We won't know if the Iranians are swimming naked until the oil tide goes out."
During his six years in office, Ahmadinejad has seen presidents and prime ministers come and go in Washington, London, Israel and Russia and has earned a reputation on the world stage for provocative hostility to the West.
The decision earlier this week to shift sensitive uranium enrichment to a mountain bunker and triple the output capacity of the nuclear fuel showed he is in no mood to compromise with countries that are piling on sanctions.
The United States maintains a veiled threat of military action to stop Iran getting the bomb.
Ahmadinejad said at his news conference there is no incentive major powers could offer to persuade Iran to stop enriching uranium -- the process which makes nuclear fuel, or, if done to a higher level, weapons material.
The defense of Iran's right to all types of peaceful nuclear technology plays well to a nationalist electorate and is in line with the view of Khamenei, who has final say on the country's biggest issues.
Analysts say Ahmadinejad is more likely to harden his stance in what remains of his presidency.
"One way for Ahmadinejad to try to get back in the good graces of Iran's hardline clerics will be to be even more vitriolic toward the United States and Israel. I don't doubt that he will rise to the occasion," said Sadjadpour.
"I expect that in the coming year Iran's rhetoric toward Israel will be even more hostile than usual, and it's plausible that they might use Hezbollah to provoke a conflict with Israel."
Yet with criticism mounting from hardline rivals who are jostling for position ahead of parliamentary elections early next year and the presidential race in 2012, some question whether Ahmadinejad will make it to the end of his term.
"Khamenei's ideal scenario is to have a weakened president who can absorb responsibility for Iran's economic and political malaise," said Sadjadpour, predicting Ahmadinejad would stay.
Farhi was less certain when asked if he expected the president to serve out his term.
"He may or may not. His fate as president will depend on him and whether he will continue to challenge other institutions.
"He will probably be able to survive as a lame duck president. But being a lame duck is not what he has shown to be in his character."
(Editing by Jon Hemming)