  Counted among the most powerful cosmic events, supernovae (SNe) and gamma-ray
bursts (GRBs) can be highly disruptive for life: Their radiation can be harmful
for biota or induce extinction by removing most of the protective atmospheric
ozone layer from terrestrial planets (TPs). Nearby high-energy transient
astrophysical events have been proposed as possible triggers of mass
extinctions on Earth. We assess the habitability of the Milky Way (MW)
throughout its cosmic history against potentially disruptive astrophysical
transients with the aim of identifying the safest places and epochs within our
Galaxy. We also test the hypothesis that one long GRB played a leading role in
the late Ordovician mass-extinction event (~445 Myr ago). We characterised the
habitability of the MW throughout its cosmic history as a function of
galactocentric distance of TPs. We estimated the dangerous effects of transient
astrophysical events (long and short GRBs and SNe) with a model that connects
their rate to the specific star formation and metallicity evolution within the
Galaxy throughout its cosmic history. Our model also accounts for the
probability that TPs form around FGK and M stars. Until about six billion years
ago, the outskirts of the Galaxy were the safest places to live, despite the
relatively low density of TPs. In the last about four billion years, regions
between 2 and 8 kpc from the center, which had a higher density of TPs, became
the best places for a relatively safer biotic life growth. We confirm the
hypothesis that one long GRB played a leading role in the late Ordovician
mass-extinction event. In the last 500 Myr, the safest neighborhood in the
Galaxy was a region at a distance of 2 to 8 kpc from the Galactic center,
whereas the MW outskirts were sterilized by two to five long GRBs.
