Mercury levels in popular fish — including tuna, salmon and swordfish — are rising, and climate change and overfishing may be to blame, a new study suggests.

That mercury levels would increase in fish is counterintuitive, given that government regulations have driven down the amount of mercury found in the air and the oceans over the past few decades.

“You would expect that as mercury was reduced in seawater, then it would go down in all the fish,” said the study’s lead author, Amina Schartup, who was a research associate at the Harvard School of Engineering and Applied Sciences when working on the study. “But there was variability. We were trying to tease out the different factors contributing to those differences.”

Warmer water appears to be one of those contributing factors, the researchers reported Wednesday in Nature.

Using three decades of data on methylmercury concentrations in the ecosystem, sediment and seawater from the Gulf of Maine, Schartup and her colleagues were able to construct a model and investigate the causes for changes in mercury levels in the Atlantic cod and dogfish living there.

Because the Maine waters have been overfished, cod and dogfish were forced to change the types of prey they consumed. Cod ended up devouring more lobsters and other large invertebrates, which are low in mercury, while the dogfish went for more squid and other cephalopods, which tend to be high in mercury. Unsurprisingly, the cod ended up with lower mercury levels than the dogfish.

The researchers next turned their model on Atlantic blue fin tuna, hoping to explain why the fish, which did not experience any changes in the type of prey they ate, also had increases in mercury — even as levels of the compound were decreasing in the ocean.

Schartup was mulling that question over when she heard an interview with Michael Phelps, the Olympic swimmer. In the interview, Phelps revealed that he consumes about six times more calories each day than the average person, leading Schartup to wonder whether something similar might explain the high mercury levels in tuna.

The oceans were warming. And as a result, the fish were becoming more active, Schartup said. “Because of that, they needed more energy to move, so they ate more,” she added.

That could explain the rise in mercury levels: as the tuna increased the amount of smaller fish they were consuming — all of which contained some mercury — the levels of neurotoxin stored in their muscles also increased.

Schartup’s model suggested that the warming trend in the Gulf of Maine would lead to a 30 percent increase in the amount of mercury found in resident tuna between 2015 and 2030. Indeed, mercury measurements in tuna from 2012 to 2017 appear to bolster the model’s findings. During that time, mercury levels rose 3.5 percent per year, the researchers found.

One important message from the new study is that “climate change and the warming of the oceans have a big impact,” said David Die, a tuna specialist and a research associate professor at the University of Miami. “And the warming waters may have unintended impacts on our health that we haven’t thought of.”

The tuna analysis makes sense, because these fish do “have higher metabolisms in warm water, which would tend to allow them to accumulate more pollutants because they have to eat more,” said Die, who wasn’t involved with the new research.

Still, the new findings don’t mean we should go cold turkey on tuna, Die said, adding that we just shouldn’t eat it every day. “Rather than choosing to stop eating fish, we should find ways to stop the oceans from warming,” he said.

This study is “another reminder to us of the complicated connections between different species we interact with directly and indirectly,” said Jillian Fry, an assistant professor at Towson University and a researcher with the Johns Hopkins Center for a Livable Future. “Not only is it important for humans to pay attention to what they eat, but also whether there are any contaminants in what they are eating.”

That may mean cutting back on big predator fish like tuna and eating more smaller fish, Fry said. That would not only be healthier because of lower mercury levels, but also would be better for the environment, she added.

Follow NBC HEALTH on Twitter & Facebook.