A general theory of the origin of ecosystems in thermodynamic terms is developed. Regular fluctuations in the availablility of energy give rise to dissipative structures in systems where the boundary constraints preclude the development of the equilibrium state. Dissipative structures are patterns in the energy flow that cease to exist when the energy flow ceases; when in the vicinity of their equilibrium position, they tend to a state of least entropy production. The ecodeme, or group of like individuals interacting equally within the constraints of the niche boundaries, exhibits the characteristics of a dissipative structure. The characteristics of a dissipative structure demand that it actively acquire and conserve energy, and that it exhibit organization. Organization implies the existence of order and a goal or end point; order is represented by uniformity of individuals in the ecodeme, the goal is represented by the state of least entropy production. Within the ecosystem ecodemes interact so that the system as a whole tends to proceed to a state of maximum entropy and maximum entropy production rate. In this way the ecosystem functions as a series of coupled shock absorbers and tends to assume a state of maximum steadiness or least oscillation. The condition of least entropy production and least oscillation can be most clearly recognized in the dominant species at the climax in an autonomous system. An autonomous system is one that approaches the closed thermodynamic condition. The biosystem or total biological complex within the biosphere, being completely autonomous, tends towards a state of maximum steadiness within the constraints of the energy input regime. Migration patterns thus develop in response to the reduction of local instabilities caused by local differences in energy input.As organisms develop in response to fluctuations in energy availability, greatest diversity exists where the excitation of the system is most heterogeneous. Heterogeneity of excitation develops in environmental conditions that tend to be most homogeneous in their overall pattern. The more homogeneous and the greater the total amount of energy available annually, the greater the capacity to break up into a large number of minor fluctuations under the influence of the trend to increased entropy. Heterogeneity is developed under the influence of daily changes in availability and the development of physical structure in the ecosystem. Maximum diversity, therefore, is attained in those geographical regions in which wet tropical forest develops. As the heterogeneity of the overall climatic pattern increases and total energy available decreases with increasing latitude, so diversity tends to be reduced, and individual biomass, relative to input, increases.Evolution results from continuous self-acceleration of the energy flow under conditions of constant energy input. Self-acceleration results from the tendency towards ever-increasing dispersal of the energy within the ecosystem as expressed in ever-increasing diversity; increasing diversity causes an increase in the rate of energy flow. Under these circumstances the energy flow to each ecodeme tends to become attenuated so that there is selection for improved energy acquisition to maintain a satisfactory solution to the acquisition–conservation integral. This increase in acquisitive capacity demands an increase in complexity and a further increase in rate of energy flow.These concepts, by way of validation, are examined in the context of stability, energy transfer, natural selection, fitness, and the observable characteristics of evolution.Key words: thermodynamics, ecosystem, energy flow, dissipative structure, ecodeme, organization, order, diversity, stability, energy transfer, fitness, reproduction, group selection, natural selection, evolution