Communities surrounding California’s San Francisco Bay will invest some $1.5 billion over the next 21 years to upgrade 1,500 miles of sewer-system infrastructure as a result of a consent decree lodged in federal court on July 28.

The Clean Water Settlement was hammered out by the U.S. Environmental Protection Agency, the East Bay Municipal Water District (EBMUD) and seven East Bay communities: Alameda, Albany, Berkeley, Emeryville, Oakland, Piedmont and the Stege sanitary district.

The agreement resolves a lawsuit the EPA and the California State Water Resources Control Board filed, in 2009, against eight East Bay agencies to prevent spills into the bay and local overflows throughout the East Bay region.

For several years, raw sewage has discharged into San Francisco Bay due to aging sewer infrastructure that is ill-equipped to deal with heavy rainstorms, said Jared Blumenfeld, the Environmental Protection Agency’s regional administrator for the Pacific Southwest.

Oakland city officials said that, during heavy rainstorms, flows have exceeded the capacity of EBMUD’s sewage treatment plant, discharging partially treated sewage into the bay. Even during normal operations, thousands of miles of aging sewage pipes in Oakland and other cities clog due to grease, roots and other obstructions, resulting in local overflows of raw sewage, they said. Some of the pipes are more than a century old.

Under terms of the deal, the cities are expected to make improvements to their systems. Oakland, for example, is expected to spend up to an additional $13 million each year on sewer infrastructure; that amount is above the $52 million the city now is spending annually to repair and upgrade its sewer system. The city already has spent approximately $300 million on improvements to its collections system and to reduce flows.

Abby Figueroa, a spokeswoman for EBMUD, says EBMUD will upgrade 37 miles of wastewater interceptors over the next few decades, for a total of approximately $70 million in work.

W. Benjamin Fisherow, chief of environmental enforcement in the Justice Dept.’s Environment and Natural Resources Division, said, “This settlement will result in major reductions of sewage discharges into the San Francisco Bay.”