Among the most significant mysteries that arose in the aftermath of invading Iraq was: How could Saddam Hussein have had no weapons of mass destruction? Most experts were convinced that he was very far from having usable nuclear capabilities, but there was ample evidence to suggest he had chemical and perhaps biological arms. And Saddam certainly acted like he had WMD--expelling IAEA inspectors and providing incomplete data when pressed to do so. Even those most skeptical of the Bush administration's claims about Saddam's weaponry thought U.S. troops invading Iraq might be hit with a blister or nerve agent.
When defense analysts Kevin Woods, James Lacey, and Williamson Murray set out to answer that question last year using the available post-invasion data, they concluded that Saddam Hussein had been hedging: Apparently, he wanted to maintain the prestige and deterrent effect of seeming to have chemical arms and a nascent nuclear program, which allowed him to frighten his neighbors, keep Iraqi Shiites in line, and maintain his image as a symbol of Arab defiance against the West. But he thought the risk of being punished by the international community was too great to actually maintain WMD programs in the face of threats and sanctions. So he ended up acting like he had WMD--blustering and toying with the IAEA--while secretly shutting the program down and periodically insisting that he was cooperating fully.
My reading of the National Intelligence Estimate is that it looks as if Iran may have been doing something similar. Whoever makes decisions in Iran decided that working on an actual nuclear arms program would be extremely risky, so they ordered the program shut down. Meanwhile, they continued to build up their knowledge base and nuclear enrichment capabilities--activities that are legal under the terms of the Nuclear Nonproliferation Treaty--while striking a defiant pose against the United States and seeking to expand their influence in the Persian Gulf, all the while insisting that they have no nuclear weapons program underway.
For both Iran and Iraq, this may have looked like the least costly course of action. Nuclear, chemical, and biological weapons have always been more valuable as a deterrent and a marker of status than as actual war-fighting tools. If a country can preserve those benefits while still lessening the risk of condemnation by the IAEA and a subsequent preventive strike by the U.S., then why not do both? If circumstances become more favorable in the future, then a decision to reconstitute one's WMD programs can always be made at that time. Meanwhile, by continuing to act defiant and remaining ambiguous about the status of your nuclear program, you can continue to deter and continue to convince your neighbors that you're the biggest badass on the block.
It seems like bizarre behavior: Why bluster about one's nuclear arms while secretly shutting down that very program? But that may well have been--and continue to be--the most rational course of action given these regimes' choices at hand.