Earth had a close shave with a star 70,000 years ago, when it came within 0.8 light years of our planet.
Dubbed Scholz's star, astronomers found the star passed through the Oort cloud, a collection of comets at the edge of the solar system.
No other star is known to have ever come this close to our solar system or Earth – it passed five times closer than the current closest star – Proxima Centauri.
Publishing their findings in Astrophysical Journal Letters, lead author Eric Mamajek from the University of Rochester and his team say they are 98% certain Scholz's star went through the outer Oort cloud.
The team analysed the velocity and trajectory of the low-mass star system after noticing it had an unusual mix of characteristics – it showed very slow motion across the sky, yet measurements showed it was moving away from the solar system at considerable speed.
Mamajek said: "Most stars this nearby show much larger tangential motion. The small tangential motion and proximity initially indicated that the star was most likely either moving towards a future close encounter with the solar system, or it had 'recently' come close to the solar system and was moving away.
"Sure enough, the radial velocity measurements were consistent with it running away from the Sun's vicinity - and we realized it must have had a close flyby in the past."
Researchers worked out the trajectory using telescopes in South Africa - the Southern African Large Telescope - and the Magellan telescope at Las Campanas Observatory in Chile.
Findings showed the star was moving away from our solar system and were able to trace back its position 70,000 years ago, when it was 0.8 light years from Earth – equivalent to five trillion miles or eight trillion kilometres, and extremely close encounter in astronomical distance terms.
Had the star come any closer in, reaching the inner Oort cloud, it would have triggered comet showers which could have had catastrophic effects for Earth.
Researchers note that discoveries like this will be made in the future following the launch of the European Space Agency's Gaia satellite, which will map out the distances and velocities of a billion stars – some of which may have had a close encounter with Earth in the past or will in the future.
At present, the best candidate for a star having a close encounter with Earth is the "rouge star" HIP 85605, which will come close to our solar system sometime between 240,000 and 470,000 years from now.