Proper management of the nitrogen cycle is a vital element of a successful aquarium. Excretia and other decomposing organic matter produce ammonia which is highly toxic to fish. Bacterial processes oxidize this ammonia into the slightly less toxic nitrites, and these are in turn oxidized to form the much less toxic nitrates. In the natural environment these nitrates are subsequently taken up by plants as fertilizer and this does indeed happen to some extent in an aquarium planted with real plants.
An aquarium is, however, an imperfect microcosm of the natural world. Aquariums are usually much more densely stocked with fish than the natural environment. This increases the amount of ammonia produced in the relatively small volume of the aquarium. The bacteria responsible for breaking down the ammonia colonize the surface of any objects inside the aquarium. In most cases, a biological filter is nothing more than a chemically inert porous sponge, which provides a greatly enlarged surface area on which these bacteria can develop. These bacterial colonies take several weeks to form, during which time the aquarium is vulnerable to a condition commonly known as "new tank syndrome" if stocked with fish too quickly. Some systems incorporate bacteria capable of converting nitrates into nitrogen gas.
Accumulation of toxic ammonia from decomposing wastes is the largest cause of fish mortality in new, poorly maintained, or overloaded aquariums. In the artificial environment of the aquarium, the nitrogen cycle effectively ends with the production of nitrates. In order that the nitrate level does not build up to a harmful level regular partial water changes are required to remove the nitrates and introduce new, uncontaminated water.