Hydraulic fracturing to drill for oil and natural gas has not caused widespread harm to drinking water in the United States, the Environmental Protection Agency said Thursday in a report that also warned of potential contamination of water supplies if safeguards are not maintained.

A draft study issued by the agency found specific instances where poorly constructed drilling wells or improper wastewater management affected drinking water, but said the number of cases was small compared to the large number of wells that use hydraulic fracturing, better known as fracking.

The EPA assessment tracked water used throughout the fracking process, from acquiring the water to mixing chemicals at the well site and injecting so-called “fracking fluids” into wells, to collection of wastewater, wastewater treatment and disposal.

The report identified several vulnerabilities to drinking water resources, including fracking’s effect on drought-stricken areas; inadequately cased or cemented wells resulting in below-ground migration of gases and liquids; inadequately treated wastewater discharged into drinking water resources; and spills of hydraulic fluids and wastewater.

Congress ordered the long-awaited report in 2010, as a surge in fracking fueled a nationwide boom in production of oil and natural gas. Fracking rigs have sprouted up in recent years in states from California to Pennsylvania, as energy companies take advantage of improved technology to gain access to vast stores of oil and natural gas underneath much of the continental U.S.

Fracking involves pumping huge volumes of water, sand and chemicals underground to split open rock formations so oil and gas will flow. The practice has spurred an ongoing energy boom but has raised widespread concerns that it might lead to groundwater contamination, increased air pollution and even earthquakes.

An estimated 25,000 to 30,000 new wells were drilled annually from 2011 to 2014, the report said. While fracking took place in at least 25 states, most of the activity occurred in four states: Texas, Colorado, Pennsylvania and North Dakota.

About 6,800 public drinking water sources serving more than 8.6 million people were located within 1 mile of a fracked well, the report said.

The report identified 151 cases from 2006 to 2012 in which fracking fluids or chemicals spilled on or near a drilling well. The spills ranged from 5 gallons to more than 19,000 gallons, with equipment failure the most common cause. Fluids reached surface water in 13 cases and soil in 97 cases, the report said. None of the spills were reported to have reached groundwater.

Industry groups hailed the EPA study as proof that fracking is safe, while environmental groups seized on the report’s identification of cases where fracking-related activities polluted drinking water.

“After more than five years and millions of dollars, the evidence gathered by EPA confirms what the agency has already acknowledged and what the oil and gas industry has known: hydraulic fracturing is being done safely under the strong environmental stewardship of state regulators and industry-best practices,” said Erik Milito, upstream group director of the American Petroleum Institute, the oil industry’s top lobbying group.

But Lauren Pagel, policy director of the environmental group Earthworks, said: “Today EPA confirmed what communities living with fracking have known for years: Fracking pollutes drinking water.”

“Now the Obama administration, Congress and state governments must act on that information to protect our drinking water and stop perpetuating the oil and gas industry’s myth that fracking is safe,” she said.

EPA officials said the report was not intended to prove whether fracking is safe, but instead was aimed at how state regulators, tribes, local communities and industry can best protect drinking water and reduce the risks of fracking. The report has cost $29 million since 2010, the EPA said, with another $4 million expected this year.

“It’s not a question of safe or unsafe,” Tom Burke, deputy assistant administrator of EPA’s Office of Research and Development, said in a conference call with reporters.

The issue for the EPA is “how do we best reduce vulnerabilities so we can best protect our water and water resources?”‘ Burke said.

Sen. James Inhofe, R-Okla., chairman of the Senate Environment and Public Works Committee, said the report was “the latest in a series of failed attempts” by the Obama administration to link fracking to systemic drinking water contamination.

“The Obama administration is now zero for four,” Inhofe said. “EPA, the U.S. Geological Survey and others have said that hydraulic fracturing is indeed safe.”

But Sen. Edward Markey, D-Mass., said fracking and related activities have the potential to severely impact the nation’s drinking water and endanger public health and the environment.

“While the number of cases (where fracking has contaminated drinking water) may be small, the impacts to public health and safety are large,” Markey said. “EPA must ensure that these activities occur appropriately with robust safeguards to ensure clean and safe drinking water.”