Just beyond Earth’s home in the solar system, about 94 million miles from the Sun, a coal-black asteroid slowly rotates as it orbits our star. It’s about 1,650 feet across, with a slight bulge around the middle, like a spinning top. Its low density means it’s not solid, but instead it’s likely a crumbly pile of carbon-rich rocks held together by gravity.

The asteroid is called Bennu, and every six years, its egg-shaped orbital path brings it just 185,000 miles from Earth — roughly 53,000 miles closer than our moon. In about 200 years, there’s a 1-in-2,700 chance it could sail close enough for Earth’s gravity to reel it in. That would be very bad.

Related: Space Mining: The Intergalactic Gold Rush Is On

The impact would excavate a crater nearly three miles wide and 1,500 feet deep. Locations three miles away would be buried under 50 feet of rock raining down. It would trigger a 6.7-magnitude earthquake. But the real damage would come from the air burst, caused by the meteor hurtling through the atmosphere, which could collapse buildings and tear down trees up to 30 miles away.

Luckily for us, asteroids the size of Bennu, and giant asteroids like the one that helped kill the dinosaurs 65 million years ago, don’t cross Earth’s path often. But smaller ones do all the time. They enter our atmosphere as meteors, where many blow up in mid-air; some make their way to the ground or sea. The good news is that we’re getting better at finding them — but we’re still unprepared if one does make its way to Earth.

A United Launch Alliance Atlas V rocket carrying the OSIRIS-REx spacecraft lifts off from the Cape Canaveral Air Force Station on Sept. 8 in Florida. Osiris-Rex will travel to asteroid Bennu, collect ground samples, then haul them back to Earth. John Raoux / AP

Partly to help with this, a NASA spacecraft called OSIRIS-REx is on its way to Bennu, where it will collect several pounds of asteroid samples and return them to Earth. By baking those samples and melting them down, scientists will learn what the asteroid is like, how the solar system’s rocky worlds were made, and how to protect Earth from these errant rocks — whether by pushing them away, breaking them up, or using the sun’s warmth to nudge them a different direction.

In that way, Bennu may become the asteroid that saves us all.

NASA is on an asteroid binge these days. Earlier in January, the space agency announced it is planning two more missions to these solar system crumbs over the next few years. The Lucy spacecraft will fly to Jupiter and study its Trojan asteroids, which trail behind the giant planet. The Psyche mission will travel to an iron asteroid thought to be a leftover planetary core, whose mantle and crust were lost to time and fiery collisions.

These explorations will provide planetary scientists with a wealth of new information, says Bill Bottke, who studies asteroids at the Southwest Research Institute in San Antonio.

“Locked in asteroids are stories that are telling us what was going on when the planets formed, when the solar nebula was still around,” he says. What processes does it take to form a planet?”

Fortunately, asteroid studies also tell us what it takes to wreck a planet.

This artist's rendering shows the OSIRIS-REx spacecraft collecting a sample from the asteroid Bennu using a mechanical arm to touch the asteroid's surface. NASA/Goddard Space Flight Center via AP

As Bennu whirls around its axis, its inky surface absorbs sunlight like asphalt on a hot day. As it rotates into the dark, that warmth radiates into space and it cools down again. This temperature change gives the asteroid a tiny nudge, called the Yarkovsky effect, which over time will change its orbit.

Get the mach newsletter. This site is protected by recaptcha

One of OSIRIS-REx’s main goals is to measure this phenomenon, says Daniel Scheeres, an astronomer at the University of Colorado who works on the project.

“After the mission, we should be able to update all these impact probabilities, and hopefully it will go down,” he says. “Just by testing the theory and validating it with more precise measurements, that can help all of our other predictions of the Yarkovsky effect for all other asteroids.”

Related: Is an Alien Megastructure Causing This Star's Strange Behavior?

Right now we know of about 723,367 asteroids in the solar system, and astronomers from universities and observatories around the world discover new ones almost every day. Based on statistical analysis and detailed searches, scientists think they’ve found more than 90 percent of asteroids about half a mile wide or larger, each of which would cause global extinctions if they impacted earth.

Dedicated searches have also found about 25 percent of the asteroids that measure at least 460 feet across, or roughly the size of a football stadium. But more than a million small asteroids — like one the size of a city bus that exploded over Chelyabinsk, Russia, three years ago — are thought to be out there.

A local resident shows a fragment thought to be part of a meteorite collected in a snow-covered field in Russia's Ural mountains in 2013. A meteor that exploded over Russia's Ural mountains and sent fireballs blazing to earth set off a rush to find fragments of the space rock which hunters hope could fetch thousands of dollars a piece. Andrei Romanov / Reuters

Last year, NASA consolidated its asteroid-hunting efforts under a new program called the Planetary Defense Coordination Office, which finds and tracks new objects and will issue warnings about possible impacts. Its budget for the current fiscal year includes $50 million for near-Earth asteroid observations and planetary defense, which is a tenfold increase since the beginning of the Obama administration.

But NASA isn’t the only one hunting asteroids. The Japanese Aerospace Exploration Agency has already brought back bits of one asteroid, and has another mission en route to a second. The privately funded B612 Foundation, named for the asteroid in the French children’s story “The Little Prince,” is still looking for a cash infusion of $450 million to send its telescope into space to look for near-Earth asteroids.

But all this work to find asteroids and to visit them won’t mean much if we can’t do anything about it. There are a few ways to save Earth from an asteroid. We could push it out of the way, essentially using celestial mechanics to ensure it won’t get pulled in by Earth’s gravity, or we could try to destroy the asteroid before it has a chance to destroy us.

Related: How Computers Are Learning to Predict the Future

The decision depends on how much time we have and what the asteroid is like, says Jason P. Dworkin, OSIRIS-REx project scientist at NASA’s Goddard Space Flight Center in Greenbelt, Md. Some asteroids might be easy to crumble into pieces; some could break apart into smaller stones that hit Earth in multiple places. Others might require a really big shove.

“If it was up to me, I would send a rocket with some titanium dioxide on it and paint it white, and have that Yarkovksy effect accelerate, and move it away from the Earth,” Dworkin says. Titanium dioxide is a common ingredient in sunscreen, and it looks chalky white. A spacecraft could fly to a dangerous asteroid, enter orbit around it, and spray-paint it.

“If you have something like 50 years, that could deflect it enough, and it might be a whole lot simpler than sending up nuclear weapons,” Dworkin says.

Radar images of the near-Earth asteroid Didymos and its moonlet from 2003. Didymos will be the target of AIDA's test of a kinetic impact on a small asteroid. NASA

If that doesn’t work, a nudge might do the trick. NASA and ESA plan to study this with a mission called the Asteroid Impact and Deflection Assessment (AIDA), which will slam a satellite into an asteroid in 2020.

If we don’t have 50 years or a fast enough battering ram, we might need to break up an asteroid instead. Catherine Plesko of Los Alamos National Laboratory uses supercomputers to study how to break up asteroids using nuclear explosions and “kinetic impactors,” essentially giant space cannonballs.

“Cannonball technology is actually very good technology, because you’re intercepting the object at very high speed, so it ends up being more effective than conventional high explosives,” Plesko said at a meeting of the American Geophysical Union in December. “If you really need a lot of energy, though, a nuclear burst is the way to get the largest amount of energy out to the object in the smallest possible container.”

Her simulations include equations that describe how fluids flow; the boiling and melting points of rocks depending on their densities; how light and energy propagates; and other physics. Then she can slip in a model for a given asteroid, and see how it responds to a cannonball.

If Earth decides to nuke it instead, the blast wouldn’t have to blow up the asteroid from within. The plan would entail launching a rocket with the bomb as its payload (a risky prospect, should it blow up on the launchpad) and aiming right for the asteroid. Exploding the bomb at the asteroid’s surface could disrupt its interior enough to break it apart, shifting its course and limiting the threat to Earth.

“For nuclear deflection, it really is the best idea to do an intensive load of these calculations before we even need to contemplate doing anything real,” Plesko says.

If we do need to do something real, it won’t happen overnight. It takes at least five years to design, build and launch a spacecraft that can deflect or destroy an asteroid or comet, according to astronomer Joseph Nuth of Goddard. He says humans would be wise to build a spacecraft now, and ideally two: an observer that could be quickly dispatched to learn more about the asteroid, and an interceptor that could deflect it.

“If we build it now on a normal schedule, and put that interceptor into storage, we can launch it in less than a year,” he explained at the AGU meeting. “This could mitigate the possibility of a sneaky asteroid coming in from a place that’s hard to observe, like toward the sun.” (The Chelyabinsk meteor was one such asteroid.)

Related: The Hunt For Alien Megastructures Is On

No space agency has a deflector mission yet, but scientists know a lot more today than they did even 15 years ago, Bottke says.

“There was a time where we didn’t have a program to look for objects, and it was done privately. You had guys like [astronomer Eugene] Shoemaker driving out every month to Palomar Observatory to look for them,” Bottke says. “Now we have $50 million annually to look for them. Now we’re getting serious science missions to look at these.”

Bottke and others say the increased awareness of asteroid threats has also been a boon for science, and for the people who study asteroids not only as harbingers of doom, but as messengers from Earth’s creation.

“The probability that any large asteroid is going to hit is in the near future is pretty low," Bottke says. “So I tend to focus on the more uplifting parts of asteroids.”