This condition most often is seen in a newly started aquarium, but can also occur in a tank in which there is has been an increase in the nutrients in the water, particularly nitrates and phosphates. This can happen if several fish die and are not promptly removed, or if plants die off and are not removed. Excessive feeding of fish, without cleaning the debris can also cause a sharp increase in nutrients that result in bacterial bloom.
Regular partial water changes and good tank maintenance will usually prevent severe bacterial blooms. In new tanks, the bloom will dissipate as the nitrogen cycle becomes established and stabilizes.