The NYT addresses an interesting question - why didn't Iran have a nuclear weapon ten years ago? The answer seems to be a mixture of a theocratic/revolutionary dislike of scientists and intelligentsia, a wavering commitment to the program, and a lot of "bad luck".
The "bad luck" is unlikely to have been entirely chance. The Atlantic recently wrote of Khan's (Pakistan) nuclear dissemination program; it was surprisingly well understood by everyone from intelligence agencies to industry journalists. Many of the key technologies came from European companies, and some of those were thought to have been "turned". It would be surprising if both Iran and North Korea had not experienced a substantial amount of sabotage.