The 1998 Bruce Willis movie Armageddon is one of the highest grossing films of all time. It showed Bruce Willis' character and his crew place a nuclear bomb inside a massive asteroid that was headed for Earth and they did it to blow it up and save the planet. Although the movie is not accurate scientific wise, 20 years later its plot is already making sense in the minds of experts.
Near Earth Objects or NEOs do not hit Earth often but once it does, it could wipe out the human race, just like what happened with the dinosaurs billions of years ago. The NEO threat became real and concerning when a meteoroid hit Chelyabinsk in Russia in 2013. Russia, US and EU all started giving money into the NEO project and they all are now helping develop strategies for response.
The UN has developed an embryonic international institutional infrastructure to detect asteroids in the Earth's orbit and respond to them as quickly as possible. There is also a focus at the governmental and the intergovernmental use of nuclear weapons and they are now deemed as our best hope in surviving an asteroid attack. The Russian government and the US government have been working together on a nuclear planetary defense initiative.
However, these recent developments with the space threat does not sit well with international law. Various Cold War-era treaties have ruled out nuclear planetary defense. But if a NEO was identified, the proposed nuclear response would likely violate international law.
Article IV of the 1967 Outer Space Treaty prohibits stationing any nuclear weapons in space, which would rule out the nuclear NEO defense. The 1963 Partial Test Ban Treaty is a massive barrier for states as the treaty prohibits any nuclear explosion in space and these are just some of the treaties, there are other legal hurdles as well.
The aim is to stop countries misusing the legal exception to develop militarized nuclear space programs while avoiding the issues associated with institutions like the UN Security Council to avoid humanity getting wiped out.
This strategy is complex, politically, legally and financially and it would take a lot of time to set up. But when it comes to the space threat, time is not the main issue.
The scientific and political context has changed in the past six years but the legal context is still stuck in the rules of the 1960s and it needs to be updated or else we could find ourselves in a real life Armageddon.