  We study the two-dimensional XY model with quenched random phases by Monte
Carlo simulation and finite-size scaling analysis. We determine the phase
diagram of the model and study its critical behavior as a function of disorder
and temperature. If the strength of the randomness is less than a critical
value, $\sigma_{c}$, the system has a Kosterlitz-Thouless (KT) phase transition
from the paramagnetic phase to a state with quasi-long-range order. Our data
suggest that the latter exists down to T=0 in contradiction with theories that
predict the appearance of a low-temperature reentrant phase. At the critical
disorder $T_{KT}\rightarrow 0$ and for $\sigma > \sigma_{c}$ there is no
quasi-ordered phase. At zero temperature there is a phase transition between
two different glassy states at $\sigma_{c}$. The functional dependence of the
correlation length on $\sigma$ suggests that this transition corresponds to the
disorder-driven unbinding of vortex pairs.
