Carrying capacity in ecology refers to the maximum population size that an environment can sustainably support over a long period of time. It is determined by factors such as availability of resources like food, water, and shelter, as well as the ability of the environment to absorb waste and other impacts of the population. When a population exceeds the carrying capacity of its environment, it can lead to resource depletion, competition for resources, and ultimately a decline in population size through factors like starvation, disease, or emigration. Maintaining a balance between population size and carrying capacity is crucial for the long-term health and sustainability of ecosystems.