Here's one theory. Some other things to consider: Price of oil (not just from Iran), the Iraqi Shia, stratits of Hormuz....
http://www.iran.org/tib/krt/missiledefense.htmFrom this analysis:
I believe their actions show that they have actively rebuilt their defense forces over the past ten years to counter these two threats, while almost totally neglecting the potential threat of a resurgent Iraq. For instance, Iran has devoted almost no resource to rebuilding its decimated armored divisions, which would face Iraq, whereas it has spent tremendous amounts of money and energy building up naval forces, missile units, and amphibious attack forces based at the entry to the Persian Gulf.
...
In May 1991, Iran test-fired a modified North Korean SCUD-C, demonstrating a capability to launch large numbers of 1-ton warheads against U.S. bases in Saudi Arabia and Turkey (3). A North Korean ship, the Dae Hung Ho, reached Bandar Abbas on March 10, 1992, bringing more SCUD-C missiles and manufacturing gear to Iran (4). Later that year, Iran took possession of the first of three Kilo-class submarines, purchased from Russia In July 1994, China delivered missile boats capable of launching C-802 anti-shipping missiles (5). Both the Kilos and the missile boats soon entered active service.
...
I hope you're beginning to get the larger picture, which is that the Islamic Republic of Iran takes a very broad view of strategic defense that encompasses policies - such as terrorism - which are considered beyond the pale in the West. Planning a terrorist attack, such as the Khobar Towers bombing, is far less expensive and ultimately less dangerous for Iran, than spending billions of dollars for new offensive weapons and actually using them against the United States or Israel. Terrorism provides Iran with a cheap deterrent, and the ultimate in deniability. Despite a great deal of evidence, including eye-witness reports and the arrest of at least one member of the terrorist group that carried out the Dhahran bombing who admitted to having been trained in Iran, the Clinton administration has failed to take any retaliatory measures against the Islamic Republic. (17)