A comet is a small body in the solar system that orbits the Sun and (at least occasionally) exhibits a coma (or atmosphere) and/or a tail — both due primarily to the effects of solar radiation upon the comet's nucleus, which itself is a minor planet composed of rock, dust, and ices. Due to their origins in the outer solar system and their propensity to be highly affected (or perturbed) by relatively close approaches to the major planets, comets' orbits are constantly changing. Some are moved into sungrazing orbits that destroy the comets when they are too near the Sun, while others are thrown out of the solar system forever.
Most comets are believed to originate in a cloud (the Oort cloud) at large distances from the Sun consisting of debris left over from the condensation of the solar nebula; the outer edges of such nebulae are cool enough that water exists in a solid (rather than gaseous) state. Asteroids originate via a different process, but very old comets which have lost all their volatile materials may come to resemble asteroids.