Japanese politicians in the past have made the case that having a nuclear deterrent would be legal, and the country has the material, tools, and knowledge to build a MIRV ICBM immediately if TSHTF. In general, the population is against war and nuclear weapons because of what happened to Hiroshima and Nagasaki, but I think that would change quickly if China invades Taiwan (for example).