Researchers found evidence last year 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.
The new study by German researchers suggested it was the result of two black holes or neutron stars merging in our galaxy, BBC News reported.
This collision would have hurled out vast amounts of energy.
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.
Also Read
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.
But now German researchers have offered up another culprit: a massive explosion that took place within the Milky Way.
"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," one of the authors of the paper, Professor Ralph Neuhauser, from the Institute of Astrophysics at the University of Jena, said.
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.
"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," Neuhauser said.
"Our conclusion was it was 3,000 to 12,000 light-years away - and this is within our galaxy," Neuhauser said.
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.
The study was published in the journal Monthly Notices of the Royal Astronomical Society.