Israel has nukes and Hamas still invaded them.
Perhaps nukes protect you from invasion by rational actors, but I don't think they work on zealots.
I certainly hope Iran's adversaries are rational actors.