After shirking its responsibility for years, Michigan has agreed to resolve an environmental crisis it created in Flint, by replacing thousands of lead pipes that have poisoned the city’s water. That’s good news, but it’s shameful that it took a lawsuit to make it happen.

Last week, in settlement of a lawsuit brought by residents and public interest groups, Michigan agreed to spend $87 million in state and federal funds to undo that damage and replace about 18,000 pipes in the next three years. The state will also provide residents with filters and bottled water — delivering it within 24 hours of a request from people who cannot leave their homes — and pay for regular water testing.

Flint’s misfortune drew attention to the widespread problem of contamination of water systems. So the agreement serves as a reminder of the importance of the environmental laws and regulations that the Trump administration and Republicans in Congress have made it their mission to eviscerate.

While the Environmental Protection Agency’s response to the Flint crisis was not much better than the state’s, the president’s proposed 31 percent reduction in its budget would cripple its ability to respond aggressively to the next crisis, and his disdain for its work is unlikely to encourage vigorous oversight by regional officials.