The nation's drinking water systems are deteriorating, and $384 billion needs to be spent in the next 17 years to maintain a safe supply for millions of Americans, according to the U.S. Environmental Protection Agency (EPA).

The most significant expense, $247.5 billion, should go to replacing the aging pipes, many of which are between 50 to 100 years old, the EPA said. Although upgrades need to be made to systems nationwide, the agency said California, Texas and New York need the money the most.

"States with larger populations have larger needs of money to maintain and update the pipes," said Peter Grevatt, director of EPA's Office of Ground Water and Drinking Water. Grevatt said that increased population growth coupled with the effects of climate change, such as drought, have forced communities to rely more heavily on water systems.

The survey also found that $72.5 billion is needed to prevent contamination of 73,400 water systems across the country, as well as water systems in American Indian, Alaska Native Village and other U.S. territories.

The EPA has conducted the survey every four years since 1995. The surveys have shown a surge in the funds needed to upgrade the systems from $227.3 billion in 1995 to $376 billion in 2003. EPA is required to submit its results to Congress under the Safe Drinking Water Act.

Some states, such as New York, have been able to reduce the amount of money needed since the last time the survey was conducted by making major infrastructure investments.

Infrastructure investment is something President Obama has pushed since taking office. Areas in which the administration seeks improvement include drinking water, roads, bridges, rail, and the disposal and recycling of solid waste and waste water.

The money to pay for the upgrades mainly comes from water bills paid by homeowners, the federal government, the Department of Agriculture, and the Drinking Water State Revolving Fund program.

Despite the increasing needs, the safety of water supply in the country is far from being compromised, according to the EPA.

"The United States' drinking water is among the safest in the world. The drinking water is safe, and we have to maintain the system to keep it safe," Grevatt said.