Washington (CNN) The Supreme Court on Thursday ruled that the Clean Water Act requires the federal government to regulate some groundwater pollutants that find their way into navigable waters such as oceans, rivers and streams.

The 6-3 opinion penned by Justice Stephen Breyer is a middle ground position that rejects the Trump administration's push for lesser regulation, but wipes away a lower court ruling which would have required more permits under the law.

"It makes clear that the Clean Water Act requires a permit for at least some, and potentially a lot of, groundwater pollution," said Steve Vladeck, CNN Supreme Court analyst and professor at the University of Texas School of Law.

The case centered on a once-pristine reef in Maui, Hawaii, that environmental groups say has been devastated by pollutants from a wastewater reclamation facility.

At oral arguments, several of the justices were sympathetic to environmental concerns, but also seemed concerned with the breadth of a lower court opinion that could force large counties and even single family homeowners to acquire expensive and burdensome permits under the law.

The law requires those who discharge pollutants into navigable waters from pipes or wells to obtain a federal permit. But the question presented here was whether such permits are also required for pollution that travels some distance from the pipe or well through groundwater and makes its way into navigable water.

The County of Maui owns and operates four wells at the Lahaina Wastewater Reclamation Facility, the principal wastewater treatment plant for West Maui. The wells receive approximately 4 million gallons of sewage per day from a collection system that serves about 40,000 people. The sewage is treated and either sold for irrigation purposes or injected into the wells for disposal. Some of the treated wastewater in the wells eventually reaches the ocean.

Chief Justice John Roberts and Justices Ruth Bader Ginsburg, Sonia Sotomayor, Elena Kagan and Brett Kavanaugh joined Breyer in the majority. Justices Clarence Thomas, Samuel Alito and Neil Gorsuch dissented.

"Compared to the argument that it does not require permits for any groundwater pollution, which the county and the three dissenting justices all argued, this result will both empower the federal government to more aggressively regulate such pollution and allow private parties to sue when that regulation fails," Vladeck said.

After a challenge from environmental groups, the 9th US Circuit Court of Appeals held that the county violated the Clean Water Act because it hadn't obtained proper permits. The court said that the law applied to pollutants from the well that had made its way to the ocean via groundwater.

In his opinion, Breyer said that standard was too broad and would require permitting in "surprising, even bizarre circumstances." He said it would even include pollutants carried to the navigable waters on a "bird's feathers, or, to mention more mundane instances, the 100 year migration of pollutants through 250 miles of groundwater to a river."

At oral arguments, Elbert Lin, a lawyer for the county, told the justices that the appeals court opinion was so broad it would force the county and its taxpayers to face massive liability and fines. A permit, Lin argued, may be required for pollutants that travel through a well or pipe into the Pacific Ocean, but a permit should not be required for pollutants that travel through groundwater and end up in the ocean.

David L. Henkin, a lawyer for the group Earthjustice, praised the court's ruling.

"The Supreme Court has rejected the Trump administration's effort to blow a big hole in the Clean Water Act's protections for rivers, lakes and oceans," he said in a statement. "We are glad the Court has recognized the importance of protecting clean water for all Americans."

A new test

In sending the case back down to the lower court, Breyer articulated a new test. He said that permits will be required for the discharge of pollutants that reach navigable waters via groundwater if the discharge is either "direct" or the "functional equivalent" of direct from the source.

He said that such a test would scale back on a lower court's previous ruling but would be "significantly broader" than the "extreme" position of the county and the federal government, which argued for the requirement of no such permits.

Breyer said that while the county and the government said requiring permits for discharges of pollution through groundwater into navigable waters would "vastly expand the scope" of the Clean Water Act, that, in reality, the EPA has applied such permits to "some (but not all)" such discharges for "over 30 years."

"In that time we have seen no evidence of unmanageable expansion," Breyer wrote.

Breyer added that in returning the case to the lower court, "We expect that district judges will exercise their discretion mindful, as we are, of the complexities inherent to the context of indirect discharges through groundwater, so as to calibrate the Act's penalties when, for example, a party could reasonably have that that a permit was not required."

In his own dissent, Alito was critical of the majority, saying that instead of interpreting the text of the Clean Water Act the court had "devised its own legal rules."

He said by insisting that a permit is required for direct discharges as well as their "the functional equivalent," the majority settled on a rule "that provides no clear guidance and invites arbitrary and inconsistent application."

"Just what is the 'functional equivalent' of a direct discharge?" Alito asked.

"Entities like water treatment authorities that need to know whether they must get a permit are left to guess how this nebulous standard will be applied," he said.

This story has been updated with additional information from the opinion.