For most of life on Earth, oxygen is essential, and sunlight is usually needed to produce that oxygen. But in an exciting twist, researchers have caught a common, ocean-dwelling microbe breaking all the rules.

Scientists have found that a microbe called Nitrosopumilus maritimus and several of its cousins, called ammonia oxidizing archaea (AOA), are able to survive in dark, oxygen-depleted environments by producing oxygen on their own. They do so using a biological process that hasn't been seen before.

While it's previously been established that these microbes can live in environments where oxygen is scarce, what hasn't been clear is what they get up to there – and how they're staying alive for as long as they do. That was the inspiration behind this new research.

"These guys are really abundant in the oceans, where they play an important role in the nitrogen cycle," says microbiologist Beate Kraft, from the University of Southern Denmark.

"For this they need oxygen, so it has been a long-standing puzzle why they are also very abundant in waters where there is no oxygen. We thought, do they just hang out there with no function? Are they some kind of ghost cells?"

Collect a bucket of seawater out of the ocean, and every fifth cell will be one of these organisms – that's how common they are. Here, the researchers removed the microbes from their natural habitat and transferred them to the lab.

The team wanted to take a closer look at what would happen when all the available oxygen was gone, and there was no sunlight to produce new oxygen. The same scenario happens when N. maritimus moves from oxygen-rich to oxygen-depleted waters.

What they found was something unexpected: the microorganisms produced their own oxygen to create nitrite, with nitrogen gas (dinitrogen) as a by-product.

"We saw how they used up all the oxygen in the water, and then to our surprise, within minutes, oxygen levels started increasing again," says geobiologist Don Canfield, from the University of Southern Denmark. "That was very exciting."

At the moment, the researchers aren't certain how the microbes are pulling off this trick, and the amount of oxygen produced appears to be relatively small (just enough for their own survival) – but it does look to be different to the few oxygen-without-sunlight processes that we already know about.

What the new pathway does show is that the oxygen production from N. maritimus gets linked to its production of gaseous nitrogen. The microbes are somehow converting ammonia (NH3) into nitrite (NO2-) – a process they use to metabolize energy – in an oxygen-depleted environment.

In turn, this requires them to make their own oxygen, which the team detected traces of, along with the byproduct of nitrogen gas (N2).

This process removes bioavailable nitrogen from the environment – and that's a new wrinkle in the nitrogen cycle, which underpins all ecosystems. This finding could have "far-reaching" consequences, and that needs more investigation.

"If this lifestyle is widespread in the oceans, it certainly forces us to rethink our current understanding of the marine nitrogen cycle," says Kraft.

"My next step is to investigate the phenomenon we saw in our lab cultures in oxygen depleted waters in various ocean spots around the world."

The research has been published in Science.