I don't think we know the mix. All those are there, along with the prestige of having advanced technology. With Khamenei, the man's preoccupation seems to be regime survival, and he seems to think that the essence of regime survival is finding a way to get the west to back off on its cultural invasion.
For Ahmadinejad and for many in the revolutionary guard corps, the key issue seems to be expanding Iran's influence and Iran becoming the pre-eminent player in the gulf. There may be others for whom there's more of a defensive concern, but the two key actors seem to be Khamenei and the revolutionary guard corps. With Khamenei, it's how do you get the west to back off on the cultural invasion, and with the revolutionary guard corps, it's how do you make Iran into the principal player in the region, and indeed, throughout the Muslim world.