The city of Flint and Michigan Gov. Rick Snyder (R) are scrambling to address a drinking-water-supply crisis that went on for months before local officials admitted lead levels in the water were dangerously high.

A cost-cutting move by an emergency manager (appointed by the governor in 2011) led Flint to switch, in 2014, from its longtime supplier—the city of Detroit, which is supplied by Lake Huron—to the Flint River. Monitoring by advocacy groups showed that the river’s lead levels were well above the legal limits. Flint switched back to Detroit water in October.

The city’s new mayor, Karen Weaver (D), elected in November, declared a state of emergency on Dec. 15 and asked the governor to follow suit to enable officials to address the crisis. But it wasn’t until Jan. 6 that Snyder declared an emergency and police began going door-to-door to hand out bottled water to local residents.

On Dec. 29, a water task force appointed by Snyder in November placed most of the blame on the Michigan Dept. of Environmental Quality (MDEQ). In a letter to the governor, the task force concluded, “Although many individuals and entities at state and local levels contributed to creating and prolonging the problem, MDEQ is the government agency that has responsibility to ensure safe drinking water in Michigan. It failed in that responsibility and must be held accountable for that failure.”

The same day the letter was released, the head of MDEQ, along with its chief spokesman, resigned.

Meanwhile, the U.S. Dept. of Justice has opened a federal investigation into the handling of lead contamination in Flint’s water supply.

At a Jan. 5 news conference, Weaver said, “I’m not surprised. … People need to be held accountable for what’s happened in this city because we have been impacted significantly. I’m glad Washington is paying attention.”

Additionally, the American Civil Liberties Union’s Michigan chapter, joined by the Natural Resources Defense Council, is planning to file a lawsuit against the city and state at the end of January “unless things drastically change,” says Michael Steinberg, legal director for the ACLU of Michigan. “Not only were the city and state’s actions harmful and misguided, they were illegal, too.”

The city had purchased its water from Detroit’s Water and Sewerage Dept. for 50 years. The newly established Karegnondi Water Authority (KWA) was building a new pipeline to deliver water from Lake Huron to mid-Michigan communities, including Flint and other areas of Genesee County. But the pipeline wasn’t expected to be complete until, at the earliest, sometime in 2015, leaving a gap between when the contract ran out and when the new pipeline would be completed.

The state-appointed emergency manager opted not to negotiate a short-term contract with Detroit and, instead, decided to draw water from the Flint River. Over the next several months, residents complained of negative health effects, including vomiting, after drinking the water.

Although environmental and citizen groups complained about the water quality and various groups began water-quality monitoring, officials of the city of Flint and MDEQ denied that lead levels were dangerous.

In September 2015, the city changed course: It issued a drinking-water-supply advisory and requested financial assistance from the state to switch the water system back to the Detroit system.

In the short term, the city is handing out bottled water, water filters and monitoring kits. Long-term plans include installing additional corrosion controls in the water system, replacing faucets and residential water lines, and making long-term capital investments through KWA, according to the city.

But much of the damage may already have been done. Public-school fountains and taps showed elevated lead levels, which have been associated with permanent brain damage in children. “There is a generation of people in Flint who have been affected by this,” Steinberg says.