Why is Iran developing long-range missiles with the capability of carrying nuclear warheads in parallel to its nuclear program?
Iran has been involved in multiple wars by proxy for a while now, it is unlikely an opportunity to arm itself with nukes will arise and they will not take it.
Most likely because it is a non-Arab power in the Middle East that is threatened on two sides by the world's only standing super power -- a super power that has routinely threatened invasion of Iran. Look at the WikiLeaks cables that exposed the pressure from other Middle Eastern governments for the US to invade Iran. Given the geopolitics, Iran's desire for nuclear weapons is perfectly rational.
Iran has been involved in multiple wars by proxy for a while now, it is unlikely an opportunity to arm itself with nukes will arise and they will not take it.