  In this paper, we develop the foundations of the theory of quasiregular
mappings in general metric measure spaces. In particular, nine definitions of
quasiregularity for a discrete open mapping with locally bounded multiplicity
are proved to be quantitatively equivalent when the metric measure spaces have
locally bounded geometry. We also demonstrate that some, though not all, of
these implications remain true under fairly general hypotheses.
  The major new tool appeared in our approach is a powerful factorization,
termed the pullback factorization, of a quasiregular mapping into the
composition of a 1-BLD mapping and a quasiconformal mapping in locally compact
complete metric measure spaces. This factorization also brings fundamental new
point of view of the theory of quasiregular mappings in Euclidean spaces, in
particular, a branched counterpart of quasisymmetric mappings is introduced and
is shown to be locally equivalent with quasiregular mappings, quantitatively.
  As applications of our new techniques, we answer some well-known open
problems in this field and characterize BLD mappings in metric spaces with
locally bounded geometry. In particular, a conjecture of Heinonen--Rickman is
shown to be false and an open problem of Heinonen--Rickman gets solved
affirmatively.
