Scientists are to attempt to nudge an asteroid out of its orbital path in a practice run for saving the world.
The joint US-European Aida (Asteroid Deflection & Assessment) mission will crash a probe into the smaller of a pair of binary asteroids to see if the object's path can be altered.
Although the egg-shaped target, known as "Didymoon", is only 160 metres (525ft) wide, the test will show if in principle a much larger asteroid threatening to wipe out human civilisation can be deflected the same way.
Two spacecraft, one to smack into the rock and the other to monitor the effect of the impact, will be launched in October 2020, scientists were told at the European Planetary Science Congress (EPSC) in Nantes, France.
They are due to rendezvous with Didymoon and its 750-metre wide partner Didymos in May 2022.
Dr Patrick Michel, lead investigator for the European Space Agency half of the mission, said: "To protect Earth from potentially hazardous impacts, we need to understand asteroids much better - what they are made of, their structure, origins and how they respond to collisions.
"Aida will be the first mission to study an asteroid binary system, as well as the first to test whether we can deflect an asteroid through an impact with a spacecraft. The European part of the mission... will study the structure of Didymoon and the orbit and rotation of the binary system, providing clues to its origin and evolution.
"Asteroids represent different stages in the rocky road to planetary formation, so offer fascinating snapshots into the solar system's history."
Aida is made up of two "sub-missions", the ESA-led Asteroid Impact Mission (Aim) and the American space agency Nasa's Double Asteroid Redirection Test (Dart) mission.
Dart will fire the probe into Didymoon, which orbits diamond-shaped Didymos every 12 hours from a distance of 1.1 kilometres (0.68 miles).
Aim will measure properties of Didymoon such as its mass and density and deploy a small lander to investigate the object's internal structure.
In October 2022, Aim will move out to a safe distance to observe Dart hitting the asteroid and record any changes in orbit.
Aim will also release three small "cubesat" probes to test new technologies, including inter-satellite communication links in deep space.
ESA's project scientist for the Aida/Aim mission, Dr Michael Kuppers, said: "As well as fascinating science, Aida offers a unique opportunity to demonstrate new technologies for ESA. Aim will deploy Mascot-2, the ESA's first lander since Philae, and will test operations that will give valuable experience for future Mars sample return missions and human exploration."
Recent missions have shown that asteroids vary greatly in their geology, structure and evolution.
All appear to be covered by soil, or "regolith", but this varies from fine grains to lumpy pebbles. Most asteroids are aggregates of material, rather than solid bodies, but it is not clear whether they are filled with large rocks and pockets of empty space, or gravel.
Didymos made its closest recent approach to Earth in 2003, a distance of 7.18 million kilometres (4.46 million miles).