It's been months since state officials acknowledged lead, a neurotoxin linked to symptoms ranging from anemia to mental retardation, had contaminated the water system of Flint, Michigan. Still, the beleaguered city remains a flashpoint in a national discussion about race, poverty and environmental justice. In Congress, a debate on aid for Flint and other communities with tainted water drags on.

Two years ago, while Flint was under state management due to a financial emergency, the city's water supply was switched to the Flint River as a money-saving measure. The State Department of Environmental Quality failed to require addition of an anti-corrosive agent to the new supply. It wasn't long before residents complained of water brown from iron corrosion, a local pediatrician highlighted elevated lead levels in children and an independent study showed high levels of lead in the water. State and local managers were slow to respond, and it will likely be years before public confidence is restored and Flint's water is safe to drink.

Richard Luthy, the Silas H. Palmer Professor of Civil and Environmental Engineering at Stanford and senior fellow at the Stanford Woods Institute for the Environment, discussed what we can learn from these mistakes:

How should cities facing water problems respond?

In Flint, people's complaints about discolored and foul-tasting water should have sounded alarms. It didn't, and that's indefensible. As soon as you see widespread occurrence of rusty water, you should say, "My gosh, something's wrong," and investigate the cause. This wasn't an isolated incident, and it appeared right after the change in water source.

When you test for lead, you should look for the worst-case scenario. The city said they tested for lead in Flint, but they didn't know where the lead pipes were located. That's not exactly saying, "I looked for the worst-case scenario." Initially, they also flushed water taps for a period of time before taking samples. For a worst-case scenario, you should test standing water by opening the tap and taking a sample right away. You'd likely see higher lead concentrations. The practice of "pre-flushing" before collecting samples has been shown to underestimate the lead levels.

How does the Flint story relate to other U.S. cities?

Flint has lots of homes that were built in the 1920s and 1930s. They have leaded pipes that run from the house to the main water line. It's essential to manage municipal water systems, particularly that of an older city, with control measures to mitigate against corrosion.

In Flint's case, previously they bought water from Detroit's system that used a compound called orthophosphate to control lead levels. Chemically, it's like coating the inside of the pipes with a passive material. The thing about having the water chemistry right is that it's not just about lead. You don't want the whole system to corrode away during an expected service life of 50 to 100 years or more. For a water quality professional, it's really important you get this right. If you mess with the water chemistry, you can really screw things up.

If Flint's water is being treated properly now, why does it remain tainted with lead?

These things don't work overnight. You can't just add an anti-corrosive agent and have it do its job right away. You want enough treatment to do the job, but not clog lines. You do it gently over time. If you live in Flint, you're not going to be drinking your water for quite a while – how long is unclear.

What is the solution and how much will it cost?

They need to know where all of the lead pipes are. You have to do house-by-house surveys to figure out where the lead is in the system. There's talk of replacing the lead service lines. The cost estimates vary widely. In the end, it's likely to be hundreds of millions of dollars, according Michigan's senators and other officials.

How can we ensure this doesn't happen again?

We need to re-examine how water managers assess for water contamination and assure a wholesome supply. You need competent people to manage your water infrastructure. In this situation, we have a problem with a poor, small city that has to provide safe water but doesn't have the staff to do it. In the case of Flint, there was another issue: The city was in receivership and the interim manager appointed by the governor was making decisions. What does he know about water? Who is checking that everything is going to be fine? The mayor and city council voted in March 2015 to shift back to Detroit's water. But the Flint emergency manager disagreed with that. This was a failure of government and a failure of responsibility and competency.

The shame in all of this is they could have avoided the problem at low cost. Instead, money that could have gone to much-needed schools, social services and community centers will go to lawsuits, health studies and water pipes. It's really a tragedy for the children exposed to the lead and for their families, as well as for a city struggling to rebuild itself.

Urban water infrastructure across the United States is aging and in need of repair. How should we deal with the situation?

At Stanford, we are teaming with other universities in the West to study ways to re-invent our nation's urban water infrastructure. Our engineering research center, called ReNUWIt (Re-inventing the Nation's Urban Water Infrastructure), is seeking more sustainable solutions for the use, reuse and management of water resources. We are examining new ways to reuse water that save energy and money, and that provide water for reuse where it's generated and needed. This systems-level thinking can help us make wise investments for the long term. Decisions about water supply and water infrastructure during a crisis, whether financial climatological, can lead to bad outcomes.