A NASA spacecraft that took a sample from an asteroid 200 million miles (321 million kilometres) away now has a plan to come back home.

On May 10, NASA's OSIRIS-REx spacecraft will leave the near-Earth asteroid Bennu and begin a nearly three-year journey back to Earth, NASA officials announced this week.

The spacecraft, formally known as the Origins, Spectral Interpretation, Resource Identification, Security, Regolith Explorer, is carrying a hefty sample it collected from the asteroid's surface in October. The goal of the mission was to collect 60 grams or 2 ounces of material -- and even though the scientists won't know for sure until they open it, it appears the collection event exceeded this goal. Regolith is a layer of dust and broken rocks on the surface of asteroids and planets.

The sample from the asteroid could shed more light on the formation of the solar system and how elements like water may have been delivered to early Earth by impacts from these rocky leftovers.

When OSIRIS-REx departs Bennu in May, it will begin the 200 millione mile (321 million kilometres) trek back to Earth. It's expected to deliver the sample to Earth on September 24, 2023.

The spacecraft first arrived for a close look at Bennu in 2018 and has been orbiting the asteroid ever since. And it's going to take one last look at the asteroid before the spacecraft bids farewell to its single companion in space for the last few years.

In April, the spacecraft will conduct a final flyby of the asteroid to see how the spacecraft's contact with Bennu's surface may have altered the sample collection site.

Originally, OSIRIS-REx was scheduled to leave Bennu in March.

"Leaving Bennu's vicinity in May puts us in the 'sweet spot,' when the departure maneuver will consume the least amount of the spacecraft's onboard fuel," said Michael Moreau, OSIRIS-REx deputy project manager at NASA's Goddard Space Flight Center in Greenbelt, Maryland, in a statement.

"Nevertheless, with over 593 miles per hour (265 meters per second) of velocity change, this will be the largest propulsive maneuver conducted by OSIRIS-REx since the approach to Bennu in October 2018."

The early April flyby wasn't initially part of the mission, so a May departure allows more time for this last look.

If all goes according to plan, OSIRIS-REx will fly over the sample site, called Nightingale, from two miles (3.2 kilomtres) away.

When the sample collection head on the spacecraft's arm descended to the asteroid's surface in October, it actually sank about 1.6 feet (0.48 meters) beneath the material sitting on the asteroid. This was called the TAG, or Touch and Go, event.

The spacecraft also fired its thrusters to safely back away from the asteroid.

Both of these events likely kicked up material on the surface of the asteroid and changed the appearance of the Nightingale site.

This flyby will be similar to the observational ones OSIRIS-REx conducted of Bennu for about a year before the mission team decided on the right place to land and collect a sample.

The spacecraft will observe a full rotation of Bennu, including its northern and southern hemispheres and equator, and those images can be compared with the images it collected in 2019.

The flyby also serves as a good test for the scientific instruments on OSIRIS-REx, which may have been covered in dust during the sample collection. The spacecraft may have a future beyond this mission if everything is working in order since it will simply drop off the sample to Earth, not land back on the planet.

Once OSIRIS-REx approaches Earth in 2023, it will jettison the capsule containing the sample, which will shoot through Earth's atmosphere and parachute down in the Utah desert.

A team will be ready to retrieve the sample from an aircraft hangar that will serve as a temporary clean room. The sample will then be whisked away to labs that are currently under construction at Johnson Space Center in Houston.

"OSIRIS-REx has already provided incredible science," said Lori Glaze, NASA's director of planetary science, in a statement. "We're really excited the mission is planning one more observation flyby of asteroid Bennu to provide new information about how the asteroid responded to TAG and to render a proper farewell."