Ecology is the study of the distribution of lifeforms throughout the galaxy, and how those lifeforms interact with other lifeforms and their environments. It is a multi-disciplinary science which focuses on a broad range of studies relating to living organisms. Ecology is generally considered to be a branch of biology.
Typically, several ecologies would develop independently on a Class M world. These were usually separated by large distances, although there were some rare occurrences where vastly different ecologies co-existed significantly close to one another. Some examples of this included the planet Lactra VII and the Genesis Planet. (TAS: "The Eye of the Beholder", Star Trek III: The Search for Spock)
- It is interesting to note that both these worlds were heavily terraformed, perhaps suggesting a link between terraforming and abnormal ecological development.