BBC News, Tehran
For the past three years, he has been the lucky president.
Everything seems to have fallen the right way for Mahmoud Ahmadinejad of Iran.
There was international disarray over his country's nuclear programme; Israel's ill-thought-out attack on Lebanon in 2006 that spurred support for Hezbollah and the president; and the perhaps fortuitous capture of a group of British troops off its coast last year.
Above all, record oil prices have enabled Mr Ahmadinejad to go on an unprecedented spending spree at home and abroad, including buying support, according to his critics.
But now his luck may be turning. In fact, in a few months Iran could face an economic "perfect storm".
The maths is simple. For every dollar on the price of a barrel of oil, Iran earns approximately a billion dollars a year. In the past few weeks and months, the price of Iranian oil has dropped between $50 and $60 a barrel.
The head of the Central Bank of Iran has warned that revenues could be cut by $54bn, effectively halving the country's income from oil, which accounts for the vast majority of both its export earnings and government revenue.
Petropars, a subsidiary of the National Iranian Oil Company (NOIC), has even warned that it could go into bankruptcy.
As the effect of those lower oil prices works through, Iran will face a growing budget deficit. The International Monetary Fund said in August that Iran would face unsustainable deficits should prices for its oil fall below $75 a barrel.
Mr Ahmadinejad will have the choice of cutting spending or printing more money. But with inflation already over 25% and unemployment around 10%, neither is an attractive option.
The real trouble for the president is that the crunch will probably come just a couple of months before he stands for re-election in June next year.
Mr Ahmadinejad has been working on a scheme to replace subsidies on basic items with a system of cash payments to the poor. It is a change most orthodox economists would support, but the idea has a distinctly Iranian twist.
There was due to be an overlap - start the cash payments before withdrawing the subsidies. And that overlap, conveniently, was due to happen just before the election.
So, Iran's poor would go to the polls flush with cash, and, of course, grateful to the president. All that becomes a lot more difficult if the cash has run out.
At this point, many countries might consider raising taxes, but that has huge drawbacks as well.
The government recently tried to impose a 3% value added tax (VAT) on various items, but it quickly provoked a strike among market traders, the so-called bazaaris, in the capital, Tehran, and other major cities.
The bazaaris are credited with playing a crucial role in the success of the Islamic Revolution in 1979. Their status and power within Iran is almost mythical.
They are therefore not a group the government wants to antagonise, and the tax was swiftly withdrawn.
Then there is the international context as well.
As Iran confronts the world over its controversial nuclear programme, high oil prices have been the insurance policy.
When oil was nudging $150 a barrel, it knew the world did not dare risk pushing prices even higher by imposing tough new sanctions, let alone military confrontation. That all looks very different now.
The strongest tool in the armoury of the US and Europe may be to impose an embargo on petrol sales to Iran.
If Russia blocks agreement at the UN Security Council, they could act unilaterally, or multilaterally.
Amazingly, this oil rich country is heavily dependent on petrol imports because of a lack of refinery capacity.
Iranians love their cars and any restriction on their freedom to drive will not make them happy. Low oil prices make this a distinct possibility.
At the very least, the global credit crunch means there is simply not the money in the global economy for the sort of multi-billion dollar investment that Iran needs for its oil and gas fields.
The government's immediate response has been to call for higher oil prices.
At an emergency meeting of the oil producers' cartel, Opec, on Friday, it will press for a staged cut in production, aimed at bringing down oil output by 2.5 million barrels of oil a day.
Ideally, Iran would like to see oil back at $100. The realists here know their best hope is probably to keep prices steady, between $70 and $80 a barrel.
The question everyone in the know in Iran keeps asking is: what is the magic number? What price oil does Iran need to keep afloat?
Whatever the precise answer, it is looking increasingly likely that President Ahmadinejad's luck has finally run out.
6 months ago