The retention of part of the Sun's energy in the Earth's atmosphere in the form of heat as a result of the presence of greenhouse gases. Solar energy, mostly in the form of short-wavelength visible radiation, penetrates the atmosphere and is absorbed by the Earth's surface. The heated surface then radiates some of that energy into the atmosphere in the form of longer-wavelength infrared radiation. Although some of this radiation escapes into space, much of it is absorbed by greenhouse gases in the lower atmosphere, which in turn re-radiate a portion back to the Earth's surface. The atmosphere thus acts in a manner roughly analagous to the glass in a greenhouse, which allows sunlight to penetrate and warm the plants and soil but which traps most of the resulting heat energy inside. The greenhouse effect is essential to life on Earth; however, the intensification of its effect due to increased levels of greenhouse gases in the atmosphere is considered to be the main contributing factor to global warming.