Another important source of gas that formed the secondary
atmospheres of the terrestrial planets was impacts by
comets. Huge numbers of comets formed in the outer parts
of the Solar System and were therefore rich in volatiles.
As the giant planets of the outer Solar System grew to maturity
or migrated their orbits, their gravitational perturbations
stirred up the entire population of icy planetesimals (comet
nuclei) that orbited within their domain. Many of these icy
bodies were flung outward by the giant planets to form the
part of the Solar System known as the Oort Cloud, and some
joined other existing planetesimals in the Kuiper Belt.
Other comets were scattered into the inner parts
of the Solar System, where they could rain down on the
surfaces of the terrestrial planets. The comet nuclei brought
with them ices such as water, carbon monoxide, methane, and
ammonia. On the terrestrial planets, cometary water mixed
with the water that had been released into the atmosphere by
volcanism. On Earth, and perhaps Mars and Venus as well,
most of the water vapor then condensed as rain and flowed
into the lower areas to form the earliest oceans.