A court has approved a settlement of more than $600 million — the majority of which will be paid by the state of Michigan — in a milestone in the years-long battle over contaminated water in Flint, one of the nation’s worst public health disasters.

The $626 million deal to settle most lawsuits filed by Flint residents is one of the largest in the state’s history, according to District Judge Judith Levy’s ruling. Children in Flint who were exposed to dangerous lead-contaminated drinking water are set to benefit in particular from the decision.

“The settlement reached here is a remarkable achievement for many reasons, not the least of which is that it sets forth a comprehensive compensation program and timeline that is consistent for every qualifying participant,” Levy said in the 178-page opinion.

“Plaintiffs’ motion for attorney fees will be addressed in a separate opinion and order,” she said, leaving the issue of attorneys seeking as much as $200 million in legal fees from the overall settlement for another day.

The crisis in Flint has become synonymous with one of worst environmental disasters in American history.

In early 2014, officials stopped drawing water from Lake Huron and switched to the Flint River in a bid to save money. The state failed, however, to ensure that proper corrosion-control chemicals were added to the new municipal water supply — an oversight that eventually resulted in lead seeping from the city’s aging pipes, flowing into homes and causing contamination.

Residents of the predominantly Black city of around 95,000 people complained of discolored and foul-smelling water and skin rashes after bathing, but their concerns were largely ignored. Some critics have since labeled the disaster an example of environmental racism.

“This is a historic and momentous day for the residents of Flint, who will finally begin to see justice served,” said Ted Leopold, one of the lead attorneys in the litigation, the Associated Press reported.

The settlement was first announced in August 2020 but received approval this week.

Under the terms of the agreement, 80 percent of the monetary award will go to residents who were younger than 18 at the time of their exposure. More than half of that amount will go toward the children younger than 6 — whose age put them at greatest risk for lead poisoning and the physical damage and neurological problems that can result. The remaining 20 percent of the payments will go to plaintiffs whose lawsuits pertained to other issues, such as property damage and loss of business revenue.

Between 18,000 and 20,000 children and adolescents lived in Flint during the water crisis, officials have estimated.

Among some children tested in 2015 at a local hospital, the percentage with lead poisoning doubled after the switch in municipal water sources. In some neighborhoods, it tripled. Rather than prompting immediate action, the test results were questioned, and the pediatrician who tried to highlight them was harshly criticized.

When the city and state finally responded, forced in part by the federal Environmental Protection Agency invoking its emergency powers, a massive effort got underway to distribute bottled water and water filters throughout Flint.

Then-Gov. Rick Snyder (R) told residents in a State of the State address in 2016: “Government failed you at the federal, state and local level.” Nine people, including Snyder, have been charged with crimes. They’ve pleaded not guilty and their cases are pending.

Although officials have declared the crisis over and note that Flint’s water quality is monitored regularly, and has met federal guidelines for five years running, some residents still harbor distrust about what flows from their taps. Many continue to use bottled water.

“Never again can we allow what happened in Flint, Michigan,” President Biden said earlier this year as he outlined how his $1 trillion infrastructure bill could boost the repair and rebuilding of the nation’s roads and bridges and aging water and wastewater pipes. “Millions of lead pipes carrying drinking water to our homes and schools and day-care centers — they’re finally going to be replaced,” Biden said.

Wednesday’s announcement is just one facet of the city’s recovery. Since 2015, Flint has received tens of millions of dollars in state and federal funding to repair its devastated water system. The city is also nearing the end of a massive lead water pipe removal program, established under a 2017 court order. Block by block, the city and its contractors have excavated and checked more than 27,000 pipes to determine what hidden risks remain. The effort has led the city to replace more than 10,000 lead pipes so far, officials say.