FLINT, Mich. (Reuters) - President Barack Obama sipped filtered water in Flint, Michigan, on Wednesday and assured angry residents that their children would be fine in the long term despite the “complete screw-up” that contaminated their drinking water with lead.

Obama made the trip to the mostly African-American community to demonstrate that the water there was safe even as he predicted it would take more than two years to replace the city’s aging pipes.

Flint, with a population of about 100,000, was under control of a state-appointed emergency manager in 2014 when it switched its water source from Detroit’s municipal system to the Flint River to save money. The city switched back in October.

The river water was more corrosive than the Detroit system and caused more lead to leach from its aging pipes. Lead can be toxic, and children are especially vulnerable.

“This was a man made disaster. This was avoidable. This was preventable,” Obama told a crowd at a local high school. “Flint’s recovery is everybody’s responsibility, and I’m going to make sure that responsibility is met.”

The president urged parents to ensure their children were tested for lead and said residents should run their taps frequently to flush out remaining pollutants.

Slideshow ( 10 images )

DRINKS THE WATER

After coughing repeatedly during his remarks, he asked for a glass of water, and drank it in front of the crowd. Earlier he sipped from a glass of filtered Flint water during a meeting with regulators. The White House had said that it did not know if the president would drink filtered Flint water.

Obama said the crisis had resulted from government officials at all levels not paying attention. Questions linger over whether environmental regulators could have acted more urgently to help the city, where more than 40 percent of its residents live in poverty.

Susan Hedman, the EPA’s Midwest chief and an Obama appointee, resigned in February amid concern that she had not acted quickly on a June 2015 memo from agency scientist Miguel Del Toral that said tests showed high lead levels in water from Flint homes.

Last month, lawyers representing residents of Flint filed a $220.2 million damages claim alleging that negligence on the part of the U.S. Environmental Protection Agency had contributed to dangerous lead levels in the city’s water.

Three Michigan state and local officials were criminally charged in April in an investigation into lead levels in Flint’s water, and the state attorney general said there would be more charges.

Many residents have blamed Michigan’s Republican governor, Rick Snyder, who was greeted by boos from the crowd. “You didn’t create this problem, government failed you,” Snyder said.

Slideshow ( 10 images )

Oscar-winning documentary filmmaker and Flint native Michael Moore disputed Obama’s assurances about the quality of the water. “A number of experts are still saying this water is not safe. It’s still going through the same corroded lead pipes,” he said on CNN, describing Obama’s visit as “too little, too late.”

Obama, going off his prepared remarks, told members of the community that their anger was understandable, but he urged them not to let their children believe they would be hurt for life.

“You should be angry, but channel that anger. You should be hurt, but don’t sink into despair,” he said. “Do not somehow communicate to our children here in this city that they’re going to be saddled with problems for the rest of their lives. Because they will not. They’ll do just fine.”

The EPA, whose budget has been squeezed by Congress, acknowledges there are issues with its lead and copper rule that need to be addressed to prevent similar crises in other cities. The agency has said it would propose changes to the rule early next year.