This article originally appeared on Time.
(DETROIT) — Michigan and the city of Flint have agreed to replace thousands of home water lines under a sweeping deal to settle a lawsuit over lead-contaminated water in the troubled city.
A court filing Monday says Flint will replace at least 18,000 lead or galvanized-steel water lines by 2020, and the state will pick up the bill with state and federal money. The state said it will pay $87 million and keep another $10 million in reserve if necessary.
The settlement will be presented to a federal judge in Detroit on Tuesday for approval.
Flint’s water was tainted with lead for at least 18 months, as the city tapped the Flint River but didn’t treat the water to reduce corrosion. As a result, lead leached from old pipes and fixtures.