More than 20 percent of the nation’s water treatment systems have violated key provisions of the Safe Drinking Water Act over the last five years, according to a New York Times analysis of federal data.

That law requires communities to deliver safe tap water to local residents. But since 2004, the water provided to more than 49 million people has contained illegal concentrations of chemicals like arsenic or radioactive substances like uranium, as well as dangerous bacteria often found in sewage.

Regulators were informed of each of those violations as they occurred. But regulatory records show that fewer than 6 percent of the water systems that broke the law were ever fined or punished by state or federal officials, including those at the Environmental Protection Agency, which has ultimate responsibility for enforcing standards.

Studies indicate that drinking water contaminants are linked to millions of instances of illness within the United States each year.