A woman tests the water at Portland's East End Beach in this BDN file photo. The city was forced to close the beach for nearly two days last July after a sewage spill caused raised bacteria levels in the waters there.

The July spill of 1.7 million gallons of sewage from Portland’s water utility into Casco Bay broke state law and warrants a fine, Maine’s environmental agency has found.

In November, the state Department of Environmental Protection informed the Portland Water District that the overflow of mostly treated wastewater from a plant on the city’s East End was among scores of incidents to violate conditions of its license and a state law governing the disposal of sewage in recent years.

The regulator’s determination follows the water district’s reporting that the spill — which temporarily closed a nearby beach and washed away portions of a walking path — was caused by an employee’s error.

[Subscribe to our free morning newsletter and get the latest headlines in your inbox]

The water district largely agrees with the DEP’s findings and is willing to enter into a consent agreement and pay a “reasonable” penalty to resolve the issues, Scott Firmin, the utility’s director of wastewater services, said Thursday.

A DEP spokesman, David Madore, said that the agency hopes to close the case by the end of January and that the amount of the possible fine hasn’t been determined yet.

In a formal notice and accompanying letter, which the DEP provided to the Bangor Daily News, an official with the Division of Water Quality Management cites the water district with nearly 90 violations dating back to 2013, the vast majority of of which are unrelated to the spill this summer. They cover issues including prohibited discharges, missed tests and power outages.

[Human error to blame for spill of 1.7 million gallons of sewage into bay, report finds]

These violations were “self-reported,” according to Firmin, who said it is important to see them in the context of the 18 thousand tests the water district runs annually. He also said that the number of violations have decreased consistently over the years and dropped dramatically after 2016 equipment upgrades.

“A lot of the violations we felt were related to the aeration system being antiquated,” said Firmin. “Once that was up and running violations went down.”

The spill that began early on the morning of July 26, however, was caused by an employee failure to fully open a release valve on a treatment tank, according to the utility’s report on the incident.

When a heavy rain began to fall around 4:25 a.m. water could not flow out of the tank quickly enough and it overflowed. The ensuing deluge poured into the nearby ocean for more than three hours and ripped up parts of an Eastern Promenade trail.

[Portland beach reopened after bacteria levels drop off]

Although the spilled water was near the end of its treatment and had been cleared of solid waste, slightly elevated bacteria levels detected in Casco Bay after the spill led the city to close the East End Beach for a day and a half.

Following the incident, the water district took a variety of steps to avoid future spills. It added checking the chlorine tank system to workers’ daily checklist, made other procedural changes and drew up a plan to install a spill alarm system, according to the incident report.

Firmin said the alarm system is estimated to cost between $50,000 and $55,000, and that the utility is waiting to hear from the DEP before moving ahead to install it.

“The corrective action we’ve already taken and hope to take will take care of the spills,” he said.

Follow BDN Portland on Facebook for the latest news in Greater Portland and southern Maine.