A method for controlling the activity of sulfate reducing bacteria or methanogenic archaea (or both) in environments containing such organisms comprising treating the environment with free nitrous acid (HNO) or with a solution containing nitrite (NO) having a pH of less than 7 or by adding nitrite to the environment and having a pH of less than 7 in the environment. The method can also disrupt biofilms.