FLINT, Mich. — Sipping filtered city water to show it’s again drinkable, President Obama promised Wednesday to ride herd on leaders at all levels of government until every drop of water flowing into homes in Flint, Michigan, is safe to use.

He promised residents that the aging pipes that contaminated the water with lead will be replaced, but cautioned that the project will take time.

“It’s not going to happen overnight, but we have to get it started,” Obama told hundreds of people gathered at a high school. Obama spoke after he was briefed on the federal response to the water contamination and had met privately with nine residents.

Obama said he understands why people are scared and angry and feel let down. He said what happened in Flint was a manmade disaster that didn’t have to happen. But he said it did happen and everyone must now work together to fix it.

“I’ve got your back,” Obama said. “I will not rest and I will make sure the leaders at every level of government don’t rest until every drop of water that flows to your homes is safe to drink, to cook with, to bathe in.”

After coughing several times during his remarks, Obama asked for and drank from a glass of water. He also drank city water after getting a lengthy briefing on the crisis, which forced residents to spend months drinking, cooking and bathing with bottled water.

In an effort to save money, the city, while under state management, began drawing its water from the Flint River in April 2014. Despite complaints from residents about the smell and taste and health problems, city leaders insisted the water was safe. However, doctors reported last September that the blood of Flint children contained high levels of lead.

The source of the city’s water has been switched back to Detroit, but the lead problem still is not fully solved, and most people are drinking filtered or bottled water.