  We employ cosmological hydrodynamical simulations to study the growth of
massive black holes (BHs) at high redshifts subject to BH merger recoils from
gravitational wave emission. We select the most massive dark matter halo at z=6
from the Millennium simulation, and resimulate its formation at much higher
resolution including gas physics and a model for BH seeding, growth and
feedback. Assuming that the initial BH seeds are relatively massive, of the
order of 10^5 Msun, and that seeding occurs around z~15 in dark matter haloes
of mass 10^9-10^10 Msun, we find that it is possible to build up supermassive
BHs (SMBHs) by z=6 that assemble most of their mass during extended
Eddington-limited accretion periods. The properties of the simulated SMBHs are
consistent with observations of z=6 quasars in terms of the estimated BH masses
and bolometric luminosities, the amount of star formation occurring within the
host halo, and the presence of highly enriched gas in the innermost regions of
the host galaxy. After a peak in the BH accretion rate at z=6, the most massive
BH has become sufficiently massive for the growth to enter into a much slower
phase of feedback-regulated accretion. We explore the full range of expected
recoils and radiative efficiencies, and also consider models with spinning BHs.
In the most `pessimistic' case where BH spins are initially high, we find that
the growth of the SMBHs can be potentially hampered if they grow mostly in
isolation and experience only a small number of mergers. Whereas BH kicks can
expel a substantial fraction of low mass BHs, they do not significantly affect
the build up of the SMBHs. On the contrary, a large number of BH mergers has
beneficial consequences for the growth of the SMBHs by considerably reducing
their spin. [Abridged]
