The formation of gaseous nitrogen and/or nitrogen oxides from nitrate or nitrite by denitrifying bacteria during anaerobic respiration.