PORTLAND — Thursday’s million-gallon spill of partially treated sewage into Casco Bay was caused by closed valves at a Portland Water District treatment facility on the city’s East End.

The overflow also lasted for nearly three hours, not less than an hour, as the water district originally reported.

The wastewater collapsed a section of the Eastern Promenade Trail and forced officials to close East End Beach until Friday afternoon, initially throwing into doubt Saturday’s annual Peaks to Portland Swim to Benefit Kids — a signature summer event in the city and a major fundraiser for the YMCA of Southern Maine.

But water tests on Friday revealed reduced levels of bacteria near the beach, prompting the city to reopen it just in time for Saturday’s swim.

“We are relieved that this is the case and are confident that participation will be safe during our event,” the YMCA said on its Facebook page. The 2.4-mile swim from Peaks Island to East End Beach is one of the oldest open-water swims in the world. It has been put on by the YMCA for 36 years.

The organization also warned, however, that the impact on the swim from routine weather concerns, including fog, will be evaluated closer to race time.

PWD spokeswoman Michelle Clements said the spill began around 4:45 a.m. Thursday, July 26, when the closed valves prevented the partially treated wastewater from getting to final treatment in a contact tank that was drained Wednesday for cleaning.

This would not have occurred if the valves were open,” Clements said. 

Contact tanks typically hold wastewater for 30 minutes, before discharging the water into Casco Bay, she added.

A trail user alerted the city to the spill, which collapsed the trail near the southern end of the plant’s retaining wall. PWD notified the Maine Department of Environmental Protection and Maine Healthy Beache.

A DEP statement Thursday said the water near the spill may show elevated levels of bacteria. Clements said other contaminants and solid materials had been filtered from the water that overflowed.

The damaged trail section will likely be closed until Wednesday, Aug. 1, according to Clements and city officials.

Clements said engineers and contractors worked Thursday to begin remediation, although the rest of the treatment plant was running normally. She said PWD will do all repairs to the trail and its properties, although cost estimates were not yet available.

She added that during the initial assessment of conditions, soil contamination from the spill did not seem likely.

Updated Friday, July 27 at 5:30 p.m.

A spill of 1 million gallons of wastewater from the Portland Water District treatment plant Thursday, July 26, collapsed the Eastern Promenade Trail in Portland and forced the closing of East End Beach.

The leak at the PWD treatment plant near East End Beach in Portland came at the southern end of the retaining wall abutting the Eastern Promenade Trail.