ST. PETERSBURG — Three environmental groups on Monday agreed to settle a federal lawsuit with the city to hold St. Petersburg accountable for spilling hundreds of millions of gallons of sewage in 2015 and 2016.If a judge approves the settlement, it will end up costing the city a total of $900,000 — so far. That figure could break the $1 million mark if St. Petersburg also has to pay the plaintiffs' legal fees.The three groups — Suncoast Waterkeeper, Inc., the Our Children's Earth Foundation and the Ecological Rights Foundation — reached the settlement nearly two years after filing the lawsuit in the Middle District of Florida in Tampa.ST. PETERSBURG SEWAGE CRISISSt. Pete sewage crisis ends with no charges, $326 million billDoes St. Pete want to settle federal sewage lawsuit? Or fight it?No criminal charges in St. Pete's 1 billion gallon sewage crisisThe December 2016 suit accused St. Petersburg of engaging in "serious and ongoing" violations of the federal Clean Water Act. The city discharged up to 1 billion gallons of wastewater from 2015-16 during the well-documented sewage crisis. While most was pumped underground, up 200 million gallons was dumped into local waterways, including Tampa Bay.The city has spent considerable time, effort and money trying to put the sewage crisis behind it. In 2017, City Council approved a consent order with the state pledging to spend $326 million to repair and upgrade the ancient sewage system that failed.According to Monday's settlement papers, the city will request an amendment to that consent order imposing new requirements, such as building an additional $7.5 million lift station to assist with pumping sewage and updating its Integrated Water Resources Master Plan. Other amendments include inspecting all of the city's gravity sewer lines and force mains, increased water quality testing and prompt public disclosures of any water quality issues or releases of sewage.In addition to committing to new infrastructure, the city also agreed to pay $200,000 to the Tampa Bay Estuary Program for projects that would benefit local ecosystems and watersheds. The program is a government partnership of local, state and federal actors whose mission is to preserve the bay.Our Children's Earth's official Annie Beaman said those funds could be spent on projects such as environmental education, planting seagrass beds or building nesting areas.The city also spent $700,000 on legal fees fighting the case. And a federal judge will decide whether St. Petersburg is responsible for paying the environmental groups' attorneys as well.The Department of Justice and the Environmental Protection Agency have 45 days to review the settlement, as is the case in any lawsuit related to the Clean Water Act. The court will then need to approve the settlement package.Beaman said there was a lot of give and take during the negotiations, but called the resulting settlement "fantastic.""It goes a long way toward ensuring progress and confirming St. Petersburg Mayor (Rick) Kriseman's and city council's absolute commitment to doing the right thing," Beaman said. "And to make sure the pipes and everything they need to spend money on over the long-term, that that's going to happen."The settlement also includes guidelines for the city to improve transparency and communication when it comes to wastewater-related matters.Mayoral spokesman Ben Kirby declined to comment on the settlement.Contact Caitlin Johnston at [email protected] or (727) 893-8779. Follow @cljohnst.