Sipping filtered city water to show it's again drinkable, President Barack 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 also promised that the aging pipes that contaminated the water with lead will be replaced, but cautioned that the project will take time. Obama said he wanted to use the crisis to make long-term improvements to the city, where more than 40 percent of residents live in poverty.

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

Obama said he understood 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'm going to make sure that the leaders at every level of government don't rest until every drop of water that flows to your homes is safe to drink and safe to cook with and safe to bathe in."

He called providing safe drinking water a basic responsibility of government.

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.

Obama declared a state of emergency in Flint in mid-January and ordered federal aid to supplement the state and local response. By then, however, the crisis was in full bloom.

It took several months for the nation to focus on the beaten-down city's plight, raising questions about how race, more than half of Flint's residents are black, and poverty influenced decisions that led to the tainted water supply and the sluggish response.

The city, in an effort to save money 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. Most people are drinking filtered or bottled water.

The political and legal fallout is ongoing. An independent commission appointed by Republican Michigan Gov. Rick Snyder determined the state was primarily responsible for the water contamination in Flint, and he issued an apology. The Obama administration's response, through the Environmental Protection Agency, has also come under criticism from Snyder and some in Congress who say the EPA didn't move with necessary urgency.

EPA Administrator Gina McCarthy told Congress that, while staff repeatedly urged the state to address the lack of corrosion controls, "we missed the opportunity late last summer to quickly get EPA's concerns on the public's radar screen." An inspector general is investigating the EPA's response.

Congress is also grappling with how to help Flint, but progress has been slow. A Senate committee last week approved a $220 million aid package as part of a broader bill that would authorize nearly $4.8 billion for water-related projects around the country. The bill could come up for a Senate vote in May.

Snyder spoke in the gymnasium during Obama's meeting and was loudly booed. Snyder said he understood why residents were angry and wanted to say he was sorry. "You didn't create this problem," Snyder said. "Government failed you."

Many in the audience yelled back at Snyder, "You failed."

Snyder was booed again when Obama spoke and mentioned him along with other elected leaders he had met with Wednesday.

"No, no, no," Obama said. "We're trying to do some business here."

Outside the school, Reneta Richard, a teacher and Flint resident, said she hoped Obama's trip would lead to something positive. She recently bought a house and said she's there for the long haul.

"I want him to leave a check — right here, right now — for pipe removal and medical bills and the life we're going to suffer," said Richard, 37, a single mom. "This isn't going to be over in 10 years."