In some of its last business of the year, the Senate on Friday passed a bill that included $170m in funding to remove lead-tainted pipes from the water supply in Flint, Michigan.

Environmentalists were concerned, however, about a “poison pill” in the legislation which rolled back environmental protections in California’s Bay-Delta estuary.

“We should not have to trade delinquent congressional action in Michigan for the erosion of endangered species protection and a threat to fishing jobs in California,” said Scott Slesinger, legislative director at the Natural Resources Defense Council, in a statement.

“But that is the result of the partisan games at play in this bill.”

Drought relief was cited as the reason for the easing of protections in the Bay-Delta. The bipartisan bill, crafted by two Californians, the Democratic senator Dianne Feinstein and the Republican representative Kevin McCarthy, will steer more water from the bay to farms for irrigation. It also opens the door to new dams, desalination and other water projects.

The outgoing California senator Barbara Boxer strongly opposed the measure, calling it “dangerous” and a “disgrace” in remarks on the Senate floor.

“You’re destroying the Endangered Species Act,” Boxer said, “and what right does anybody have to do that, in the middle of the night?”

Feinstein said: “After three years and dozens of versions of legislation, I think this is the best we can do.”

The bill was one of dozens passed in a mad dash before lawmakers return home for the holidays. Senators also passed a resolution to keep the government funded through April.

The outlays to tackle Flint’s water crisis were celebrated by Michigan government officials.

“It’s past time for Congress to put partisan politics aside and help the people of Flint, who are still without access to clean, safe drinking water from their taps,” said Senator Gary Peters.

The new money will be used to replace more than 29,000 leaden service lines that channel water from water mains to homes and businesses in the city.

Flint’s water supply began carrying dangerously high levels of lead after officials approved a change in the municipal water source. After the switch, water carried in from the Flint river was not properly treated to prevent the leaching of lead from decades-old underground pipes.

The resulting crisis exposed tens of thousands of children, who are now at increased risk of permanent health issues. Studies show the contamination may have been responsible for other health problems in the city.

The Flint crisis generated national attention and prompted a visit from Barack Obama. Several municipal officials faced criminal charges for tampering with or altering water quality tests.

The city has returned to its original water source and testing increasingly shows samples taken in the city to be within normal limits.

Regardless, Flint’s mayor, Karen Weaver, has said the only thing that can restore full confidence in the city’s water is the complete replacement of the ageing lead infrastructure.