Nitrogen-fixing bacteria in the soil and within the root nodules of some plants convert nitrogen gas in the atmosphere to ammonia. Nitrifying bacteria convert ammonia to nitrites or nitrates. ... Denitrifying bacteria converts nitrates back to nitrogen gas.