Each year, oil and gas companies engage in fracking at nearly 30,000 wells around the United States: injecting water and chemicals deep underground at high pressures to crack open shale rock and extract the fossil fuels inside. This innovation, which took off in the mid-2000s, has led to a huge boom in oil and gas production. But it's also raised concern that gas or chemicals might leak into nearby water supplies.

Now the Environmental Protection Agency has weighed in with a massive new study on the water question. After a four-year investigation, the EPA concluded that, yes, certain activities related to hydraulic fracturing can potentially threaten our drinking water supplies — say, because of gas leaking from poorly constructed wells, or due to improper handling of the wastewater that flows out after fracking is completed. The study even identified a small number of cases where contamination of drinking water had occurred, in states like Pennsylvania.

But the agency also said it couldn't find evidence that the fracking boom has led to "widespread, systematic" harm to the nation's drinking water. Maybe that's because accidents are indeed rare. Or maybe it's just because the data is patchy and incomplete. The report's authors couldn't say for sure. Here's the key section of the report:

We did not find evidence that these mechanisms have led to widespread, systemic impacts on drinking water resources in the United States. Of the potential mechanisms identified in this report, we found specific instances where one or more mechanisms led to impacts on drinking water resources, including contamination of drinking water wells. The number of identified cases, however, was small compared to the number of hydraulically fractured wells. This finding could reflect a rarity of effects on drinking water resources, but may also be due to other limiting factors. These factors include: insufficient pre- and post-fracturing data on the quality of drinking water resources; the paucity of long-term systematic studies; the presence of other sources of contamination precluding a definitive link between hydraulic fracturing activities and an impact; and the inaccessibility of some information on hydraulic fracturing activities and potential impacts.

The oil and gas industry is hailing this study as a major victory, arguing that it suggests fracking is broadly safe, despite a few problems here and there that can be fixed by smarter regulation. "Today’s draft study affirms that hydraulic fracturing does not present systemic impacts on drinking water," said Marty Durbin, CEO of America's Natural Gas Alliance, in a statement.

Environmental groups, by contrast, are focusing on the troubling instances when fracking can go awry. They're also highlighting the study's limitations. According to an by Neela Banerjee of InsideClimate News, the EPA couldn't even get permission from oil and gas companies to test water before wells were fracked and then go re-test afterward. That meant the agency couldn't establish a proper baseline to fully measure contamination.

The EPA reportedly struggled to procure key data from oil and gas companies

"The report, while limited, shows fracking can and has impacted drinking water sources in many different ways," said Amy Mall of the Natural Resources Defense Council. But, she added: "This study is missing some critical elements, hamstringing its comprehensiveness. Among other things, there are reports industry has not cooperated in providing important information."

The EPA said it hoped the new study would help policymakers decide "how best to protect drinking water resources now and in the future." Right now, fracking is largely regulated at the state level, and different states have taken very different approaches. North Dakota and Texas have adopted a light touch on regulations — and fracking for oil and gas has surged in both states. By contrast, New York State has banned fracking altogether, in part over concerns about air and water pollution.

How fracking works — and how it can harm water supplies

To better understand the potential water risks, let's first take a look at how energy companies actually employ hydraulic fracturing (and horizontal drilling) to extract natural gas from shale rock. Here's a sample operation in the Marcellus Shale in Pennsylvania:

1) First, a well needs to be drilled all the way down to the layer of gas-rich shale. This shale layer can sit more than 5,000 feet underground, and drilling can take as long as a month. The well is typically lined with cement and a steel casing to prevent any leakage into groundwater near the surface.

There are several stages where drilling could, conceivably, pollute the water

2) Once the drill reaches all the way down to the shale layer, it slowly turns and begins drilling horizontally, for a mile or more along the rock.

3) A "perforating gun" loaded with explosive charges is lowered to the bottom of the well and punctures tiny holes in the horizontal section of the casing that's deep down in the shale layer.

4) Now comes the actual "fracking," or "completion," stage: a mixture of water, sand, and chemicals is pumped into the well at extremely high pressures and goes through the tiny holes in the casing. The fluids crack open the shale rock. The sand holds those cracks open. And the chemicals help the natural gas seep out.

5) The "flowback" stage: The water and chemicals flow back out of the well and are taken for disposal or treatment.

6) Finally, natural gas begins flowing from the shale and up out of the well, where it's eventually shipped to consumers via pipeline. A typical well can produce gas for 20 to 40 years, pumping out thousands of cubic feet of gas each day.

Now, there are lots of different points during the above process that could potentially threaten water supplies, as the EPA illustrates in this graphic:

Some examples:

1) Fracking requires a lot of water: It takes a lot of water to crack open that shale rock, between 1 and 5 million gallons per well. Nationwide, the EPA study estimates, the fracking industry used some 44 billion gallons of water in 2011 and 2012. That was only 1 percent of the nation's freshwater, but in areas like western Texas, the fraction was far higher — and, in these areas, better water management may be needed.

2) Poorly constructed wells can leak methane or chemicals: This is one potential source of contamination of water supplies near the surface. In recent years, fracking wells have blown out in states like North Dakota. In another incident, thousands of gallons of fracking fluid leaked out of a storage tank in Dimock, Pennsylvania. And poorly constructed wells with cement problems can allow fluids or gas to migrate upward.

The EPA study notes that this is a particular concern for older wells that were drilled before they were repurposed for fracking. "Although new wells can be designed to withstand the stresses associated with hydraulic fracturing operations, older wells may not have been built or tested to the same specifications and their reuse for this purpose could be of concern," the study notes.

Again, it was difficult to say how often this happened. The agency found evidence that between 0.4 and 12 spills of chemicals or fracking fluids occurred for every 100 fracked wells in Pennsylvania. (None of those spills contaminated groundwater.) If you extrapolated this nationwide, it would mean somewhere between 100 and 3,700 spills annually. But, the EPA noted, "it is unknown whether these spill estimates are representative of national occurrences."

3) Wastewater pollution: A separate issue is what happens with all that water after it has been used to crack open shale and is pumped back up to the surface. The oil and gas industry produces billions of gallons of this murky wastewater each year, which typically contains chemicals that were added for the fracking process.

In many states, this wastewater is pumped back underground into separate "injection wells." But when there aren't enough injection wells available, the water is either stored in tanks and holding ponds or sent off to treatment plants. That raises the risk of either accidental spills or improper treatment. In 2013, three treatment plants in Pennsylvania were fined for dumping waste into the Allegheny River.

The EPA notes that accidents are relatively rare, but they can be destructive: "The EPA characterization of hydraulic fracturing-related spills found that 8% of the 225 produced water spills included in the study reached surface water or ground water. These spills tended to be of greater volume than spills that did not reach a water body. A well blowout in Bradford County, Pennsylvania spilled an estimated 10,000 gal of produced water into a tributary of Towanda Creek, a state-designated trout fishery."

In its report, the EPA could not find evidence that these incidents added up to "systematic" or "widespread" harm to America's drinking water supplies. But, again, it's unclear if that's because contamination is rare or the data is just incomplete. Don't expect this to be the end of the fracking debate.