  MAGIC, a system of two imaging atmospheric Cherenkov telescopes, achieves its
best performance under dark conditions, i.e. in absence of moonlight or
twilight. Since operating the telescopes only during dark time would severely
limit the duty cycle, observations are also performed when the Moon is present
in the sky. Here we develop a dedicated Moon-adapted analysis to characterize
the performance of MAGIC under moonlight. We evaluate energy threshold, angular
resolution and sensitivity of MAGIC under different background light levels,
based on Crab Nebula observations and tuned Monte Carlo simulations. This study
includes observations taken under non-standard hardware configurations, such as
reducing the camera photomultiplier tubes gain by a factor ~1.7 (Reduced HV
settings) with respect to standard settings (Nominal HV) or using UV-pass
filters to strongly reduce the amount of moonlight reaching the cameras of the
telescopes. The Crab Nebula spectrum is correctly reconstructed in all the
studied illumination levels, that reach up to 30 times brighter than under dark
conditions. The main effect of moonlight is an increase in the analysis energy
threshold and in the systematic uncertainties on the flux normalization. The
sensitivity degradation is constrained to be below 10%, within 15-30% and
between 60 and 80% for Nominal HV, Reduced HV and UV-pass filter observations,
respectively. No worsening of the angular resolution was found. Thanks to
observations during moonlight, the maximal duty cycle of MAGIC can be increased
from ~18%, under dark nights only, to up to ~40% in total with only moderate
performance degradation.
