If countries could actually count on the UN charter and international law protecting them from invasion, they wouldn't need nukes so much.
If Saddam actually had nukes, he might not have been invaded. If Iran had nukes, they might not have had their government overthrown, might not have been invaded by Iraq, might not have as much concern about potential military attack now. Any country that might be attacked benefits greatly from that deterrent.
However, that deterrent is also hugely dangerous for the world. At some point, it can go from being a deterrent to a miscalculation where they are used.
This is one reason why there were such concerns about undermining every country's feeling of protection with the invasion of Iraq.
Some here, though, are ideological enemies against the UN preventing aggressive war.