Nitrogen is an element required for growth by all biological systems.  While extremely common (80% by volume) in the atmosphere, dinitrogen gas () is generally biologically inaccessible due to its high activation energy.  Throughout all of nature, only specialized bacteria and Archaea are capable of nitrogen fixation, converting dinitrogen gas into ammonia (), which is easily assimilated by all organisms.  These prokaryotes, therefore, are very important ecologically and are often essential for the survival of entire ecosystems.  This is especially true in the ocean, where nitrogen-fixing cyanobacteria are often the only sources of fixed nitrogen, and in soils, where specialized symbioses exist between legumes and their nitrogen-fixing partners to provide the nitrogen needed by these plants for growth.
Nitrogen fixation can be found distributed throughout nearly all bacterial lineages and physiological classes but is not a universal property.  Because the enzyme nitrogenase, responsible for nitrogen fixation, is very sensitive to oxygen which will inhibit it irreversibly, all nitrogen-fixing organisms must possess some mechanism to keep the concentration of oxygen low.  Examples include:
* heterocyst formation (cyanobacteria e.g. Anabaena) where one cell does not photosynthesize but instead fixes nitrogen for its neighbors which in turn provide it with energy
* root nodule symbioses (e.g. Rhizobium) with plants that supply oxygen to the bacteria bound to molecules of leghaemoglobin
* anaerobic lifestyle (e.g. Clostridium pasteurianum)
* very fast metabolism (e.g. Azotobacter vinelandii)
The production and activity of nitrogenases is very highly regulated, both because nitrogen fixation is an extremely energetically expensive process (16–24 ATP are used per  fixed) and due to the extreme sensitivity of the nitrogenase to oxygen.