Imagine the day observatories confirm that an asteroid is on a collision course with Earth; space-faring nations agree we need to stop it. What happens next depends on how much time the asteroid watchers say we have. None of these options are easy, and at least one of them would require the use of nuclear weapons.

Major asteroid strikes are rare. The last one that could have caused massive loss of life was the Tunguska event of 1908, in which what was believed to be a meteorite exploded some 10 kilometres above a remote area of Siberia.

That type of impact occurs once every few centuries. Siberia, however, is remote; even today the population is small and scattered across a huge area. Had the same object arrived four of five hours later, the major city of St Petersburg would have been hit with the equivalent of a megaton-scale nuclear explosion.

We have seen a smaller version of this nightmare scenario more recently. In 2013, the Chelyabinsk Meteor, which disintegrated at an altitude of 30 kilometres, shattered windows and injured 1,400 people in the western Russian city. It delivered an explosion equal to about 500 kilotons – about 30 or so Hiroshima bombs – though it exploded high enough to not cause too much structural damage. That kind of impact is much more common, occurring about three times per year. Most occur over the ocean or in remote areas, so we usually don't notice. But the question isn't if an impact will happen, but when. 

Governments are taking this seriously; taking the first tentative steps to preventing a dangerous impact. In January, Nasa formed the Planetary Defense Coordination Office to act as a clearing house for asteroid observations and work with other space agencies to discuss how large space rocks on a collision course with Earth might be dealt with.

Right now, the PDCO spends much of its effort in detection, coordinating various observation programs, says Lindley Johnson, Nasa's planetary defense officer. That's because you can't deal with the space rocks until you know where they are. "We try to detect anything that might be a threat years, if not decades, in advance," he says. Once a dangerous asteroid is identified, the actual plans for stopping one enter the picture.

The simplest method is a kind of planetary billiards, using a space probe to send a heavy object (or the probe itself) smashing into it. The asteroid will then, hopefully, be pushed off course and miss the Earth.

The idea is to find out exactly how much one can move an asteroid without running the risk of sending it on a dangerous trajectory

A joint European Space Agency and Nasa mission will test such technology in the next few years, under the name Asteroid Impact and Deflection Assessment (Aida). The mission consists of two spacecraft, one called the Asteroid Impact Mission (Aim), which will launch in late 2020, and the second, the Double Asteroid Redirection Test (Dart), in 2021. 

In 2022 they'll arrive at a double asteroid called 65803 Didymos, which is accompanied by a companion called Didymoon. Didymos measures some 780 metres across, while Didymoon is about 170 metres. The smaller of the two orbits the larger one every 11.9 hours, and they are close, only 1,100 metres apart. The Aim craft will rendezvous with the asteroid and study its composition. Once Dart arrives it will crash into Didymoon, and Aim will see what the effect on the smaller rock's orbit is. The idea is to find out exactly how much one can move an asteroid without running the risk of sending it on a dangerous trajectory, a kind of baby step to actually redirecting it.

To put the potential of the mission in perspective, the famous Meteor Crater in the US state of Arizona was probably made by an object only one-third the size of Didymoon, and that's 170 metres in diameter. A Didymos-size rock hitting the Earth about 15.5 kilometres per second – about the minimum speed it would be travelling at – would release something like two megatons worth of energy; easily enough to destroy a city. At its maximum speed (about 34.6 kilometres per second) it would release four megatons of energy – the equivalent of four million tonnes of TNT.

"We want to alter the orbit of the moon around the primary," says Patrick Michel, a senior researcher at France's National Centre for Scientific Research and one of the Aida team leaders, "because the orbital velocity of moon around primary is only 19cm per second." Even small change could be measured from Earth, he adds, changing Didymoon's orbital period by about four minutes.

It's also important to see if the impactor works. "All the models [of impacts] that we do are based on understanding of collision physics that is only at lab scale – centimetre-ised targets," Michel says. Whether those models are true on real asteroids is still something of an open question.

If there's less time, we might be left to try something else

Johnson adds that the technology is the most mature – humans have demonstrated the ability to get to asteroids already, notably with the Dawn mission to Ceres and Esa's Rosetta mission to comet 67P/Churyumov-Gerasimenko.

Beyond the impact approach, there's using gravity – simply putting a relatively massive spacecraft in orbit around an asteroid and letting their mutual gravitational pull gently nudge it into a new path. The advantage of this is that it only requires that the spacecraft gets there. The orbit would be a "halo" – a roughly circular path centered on the point where the gravitational force on an object would be the same from the Sun as the asteroid. Nasa's Asteroid Redirect Mission might indirectly test the idea; part of the plan is to bring an asteroid back to near-Earth space.

However, a key element in these methods is time; it takes a good four years to mount a space mission beyond Earth orbit and the spacecraft will take another year or two to get to the relevant asteroid. And if there's less time, we might be left to try something else.  

Qicheng Zhang, a physicist at the University of California, Santa Barbara, thinks lasers could be another answer. A laser won't blow the asteroid up like a Death Star. Instead it would vaporise a small part of the surface. Zhang, along with his colleagues working under experimental cosmologist Philip Lubin, presented a set of orbital simulations in a paper to the Astronomical Society of the Pacific.

This might seem like it would be ineffective, but remember that if it’s done early enough even a tiny nudge can alter an orbiting body's course by many thousands of kilometres. Zhang says the advantage of a laser is that a large one can be built in Earth orbit, and won’t need to chase an asteroid down. A laser with a power on the order of one gigawatt, firing for a month, could move an 80-metre-wide (264ft) asteroid – like that which created the Tunguska event – by the equivalent of two Earth radii (around 8,000 miles, or 12,800 kilometres). That's just enough to avoid a collision.

Another version of this idea is to send a spacecraft equipped with a less-powerful laser, though in that case it would have to reach the asteroid and follow it relatively closely. Since the laser would be smaller – in the 20 kilowatt range – it would have to operate for years, though Zhang's simulations suggest that a satellite following an asteroid, reaching it 15 years in advance, could also push it the necessary distance.

If you've seen the movie Armageddon or Deep Impact it sounds straightforward enough, but it's actually a lot harder than it sounds

Zhang says the good thing about his Earth-orbiting proposal is that following an asteroid or comet in orbit is not as easy as it looks, even though we've already done it. "Rosetta was originally intended to target a different comet (46P) until a launch delay forced them to switch targets due to 46P no longer being in a favourable position. If a comet decides to target Earth though, we don't have the luxury of switching it out for a better one." Asteroids aren't quite as difficult to track, but it will still take around three years to reach one, he says.

Johnson, though, notes one of the big problems with using a laser of any sort is that nobody has launched a kilometre-sized object of any sort into orbit, let alone an array of lasers. "There's a lot that I wouldn't consider mature; converting solar power to laser power reliably enough to operate for that long is one."

Then there's the "nuclear option". If you've seen the movie Armageddon or Deep Impact it sounds straightforward enough, but it's actually a lot harder than it sounds. "You'd need to send up an entire infrastructure," says Massimiliano Vasile, at the University of Strathclyde. He proposed detonating a nuclear bomb at some distance from the target. As with the laser, the plan here is to vaporise some of the surface, which would generate thrust and alter the asteroid's orbit. "If you ablate [erode] you have the advantage of high energy efficiency," he says.

While lasers and nuclear bombs can work when an asteroid is closer, in those cases composition becomes a significant factor, since the vaporisation temperatures will differ from one asteroid to the next. Another issue is flying rubble. There are many asteroids that might be just that – agglomerated chunks of rock that are only loosely bound. An impactor might not be as effective on that kind of body. That's a big plus for the gravity tractor method, Johnson notes – the composition and cohesion don't matter so much.

Any of these methods, however, might run into a final obstacle: politics. The 1967 Outer Space Treaty bans the use of nuclear weapons and their testing in space, and deploying a gigawatt laser in orbit might make some people nervous.

Smaller asteroids that could wipe out a city are far more common than giant planet killers – Qicheng Zhang, University of California, Santa Barbara

Zhang noted that if the power in an orbiting laser is lowered to 0.7 gigawatts, that only pushes the asteroid about 0.3 Earth radii – about 1,911 kilometers. "Smaller asteroids that could wipe out a city are far more common than giant planet killers. Now consider such an asteroid on a trajectory targeting New York. Depending on the circumstances, attempting and partially failing to deflect the asteroid from Earth might shift the site of impact to London instead, for example. If that were a substantial risk, the Europeans might not be so willing to agree to letting the US to deflect the asteroid."

Such obstacles might be less than anticipated. "There's an escape clause in these treaties," Johnson says, referring to the Outer Space and Comprehensive Test Ban Treaties. The OST doesn't prohibit the launching of ballistic missiles, for example, which travel through space and might be armed with nuclear weapons. And in light of the need for planetary defence, criticism over their use might be muted.

Michel notes that unlike any other natural disaster, this is one we can avoid. "This is something for which the natural risk is very low, compared to tsunamis and such. But it's the only one for which we can do something."

* This article has been amended to correct the projected speeds of a Didymos-sized rock hitting Earth

Join 600,000+ Future fans by liking us on Facebook, or follow us on Twitter, Google+, LinkedIn and Instagram

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.