  The extragalactic background light (EBL) is the radiation accumulated through
the history of the Universe in the wavelength range from the ultraviolet to the
far infrared. Local foregrounds make the direct measurement of the diffuse EBL
notoriously difficult, while robust lower limits have been obtained by adding
up the contributions of all the discrete sources resolved in deep infrared and
optical galaxy observations. Gamma-ray astronomy has emerged in the past few
years as a powerful tool for the study of the EBL: very-high-energy (VHE)
photons traversing cosmological distances can interact with EBL photons to
produce e$^+$e$^-$ pairs, resulting in an energy-dependent depletion of the
gamma-ray flux of distant sources that can be used to set constraints on the
EBL density. The study of the EBL is one of the key scientific programs
currently carried out by the MAGIC collaboration. We present here the results
of the analysis of 32 VHE spectra of 12 blazars in the redshift range 0.03 -
0.94, obtained with over 300 hours of observations with the MAGIC telescopes
between 2010 and 2016. A combined likelihood maximization approach is used to
evaluate the density and spectrum of the EBL most consistent with the MAGIC
observations. The results are compatible with state-of-the-art EBL models, and
constrain the EBL density to be roughly within $\simeq 20\%$ of the nominal
value in such models. The study reveals no anomalies in gamma-ray propagation
in the large optical depth regime - contrary to some claims based on
meta-analyses of published VHE spectra.
