In 2012 researchers found evidence that our planet had been struck by a blast of radiation during the Middle Ages, but there was debate over what kind of cosmic event could have caused this.
Now a study suggests it was the result of two black holes or neutron stars merging in our galaxy.
This collision would have hurled out vast amounts of energy.
The research is published in the journal Monthly Notices of the Royal Astronomical Society.
Last year, a team of researchers found that some ancient cedar trees in Japan had an unusual level of a radioactive type of carbon known as carbon-14.
In Antarctica, too, there was a spike in levels of a form of beryllium - beryllium-10 - in the ice.
These isotopes are created when intense radiation hits the atoms in the upper atmosphere, suggesting that a blast of energy had once hit our planet from space.
Using tree rings and ice-core data, researchers were able to pinpoint that this would have occurred between the years AD 774 and AD 775, but the cause of the event was a puzzle.
The possibility of a supernova - an exploding star - was put forward, but then ruled out because the debris from such an event would still be visible in telescopes today.
Another team of US physicists recently published a paper suggesting that an unusually large solar flare from the Sun could have caused the pulse of energy.
One of the authors of the paper, Professor Ralph Neuhauser, from the Institute of Astrophysics at the University of Jena, said: "We looked in the spectra of short gamma-ray bursts to estimate whether this would be consistent with the production rate of carbon-14 and beryllium-10 that we observed - and [we found] that is fully consistent."
These enormous emissions of energy occur when black holes, neutron stars or white dwarfs collide - the galactic mergers take just seconds, but they send out a vast wave of radiation.
Prof Neuhauser said: "Gamma-ray bursts are very, very explosive and energetic events, and so we considered from the energy what would be the distance given the energy observed.
"Our conclusion was it was 3,000 to 12,000 light-years away - and this is within our galaxy."
Although the event sounds dramatic, our medieval ancestors might not have noticed much.
If the gamma-ray burst happened at this distance, the radiation would have been absorbed by our atmosphere, only leaving a trace in the isotopes that eventually found their way into our trees and the ice. The researchers do not think it even emitted any visible light.
Observations of deep space suggest that gamma ray-bursts are rare. They are thought to happen at the most every 10,000 years and at the least once in a million years in a galaxy.
Prof Neuhauser said it was unlikely Planet Earth would see another one soon, but if we did, this time it could make more of an impact.
If a cosmic explosion happened at the same distance as the 8th Century event, it could knock out our satellites. But if it occurred even closer - just a few hundred light-years away - it would destroy our ozone layer, with devastating effects for life on Earth.
However, this, said Prof Neuhauser, was "extremely unlikely".
Commenting on the research, Professor Adrian Melott from the University of Kansas, US, said that although he thought a short gamma-ray burst was a possible conclusion, his group's research suggested that a solar flare was more likely based on observations of Sun-like stars in our galaxy.
He said: "A solar proton event and a short gamma-ray burst are both possible explanations, but based on the rates that we know about in the Universe, the gamma-ray burst explanation is about 10,000 times less likely to be true in that time period."