Regardless of how things play out in the Iranian nuclear drama, one has to admit that the entire process, whether intentionally or by design, has been a huge success for the Islamic Republic, Mr. Ahmadinejad and the other regressive forces of the Iranian society.
For one, in terms of the nuclear issue there aren't too many viable options for the West to stop Iran's nuclear program. Even military strikes will probably have the effect of strengthening the grips of the regime and providing an excuse for withdrawal from the NPT.
More importantly, this regime as one of the primary violator of human rights has successfully shifted all of the attention of the domestic and international communities towards the nuclear issue at a time when unions are being crushed, political prisoners are being tortured in prisons, the country is increasingly made into a police state and the rights of women and minorities is being trampled on every day.
By comparing himself to Mossadegh (Iranian PM who nationalized oil and stood up against the British), Ahmadinjead is trying to appeal to Iranian nationalism, which is as potent a force as Islam has been in shaping the Iranian society. Sadly, this strategy seems to be successful given Iran's increasing isolation from the rest of the world (and there are still some nut-cases who think isolating Iran further is going to be positive). The strategy has also left the opposition in disarray, with the MKO (the Jihadists for the Iranian Masses) and the Monarchists trying to act potential vultures in case the U.S. plans to take down the Iranian regime. The rest of the opposition consists of millions of individuals who are not ready to unite over anything, since their experiences from the 1979 revolution shows them that unity can bring more evil than good.
So essentially at a time when the economy is crumbling, the revolution has failed on its promises, unions are protesting, religious sentiments are falling and social ills like addiction are ravaging the Iranian society, Mr. Ahmadinejad has managed to use Western double standards (which are of course quite evident, see latest Bush visit to India) to invoke a sense of injustice and rally support behind the regime's nuclear ambitions.
And it seems the world is willingly playing into his hands. Machiavelli would have been proud.