House Speaker Paul Ryan and House Minority Leader Nancy Pelosi came to an agreement late Tuesday to address the water crisis in Flint, Mich., and possibly avoiding a complete government shut down later this week.

A Pelosi aide told Fox News "the amendment represents a bipartisan agreement between Speaker Ryan and Leader Pelosi to allow germane authorization language to be added to WRDA as an amendment that will, at the end of the day, provide the necessary funding Flint needs in the final WRDA conference report."

The House will now vote Wednesday on an amendment by Rep. Dan Kildee, D-Mich., to provide up to $170 million in emergency relief to combat Flint’s toxic water crisis.

The move came after a stopgap bill to prevent a government shut down and to fund the efforts to combat the Zika virus stalled in the Senate. Democrats largely opposed the measure in a Senate test vote as well as a dozen of the Senate’s most conservative members. The bill failed on a 55 to 45 vote.

The GOP defections left Senate Majority Leader Mitch McConnell, R-Ky., short of a simple majority, much less the 60 votes needed to clear a filibuster hurdle. McConnell is looking for a way out of the legislative box canyon that doesn't include capitulating on Flint, which GOP leaders fear would start a revolt among House tea party conservatives.

Republicans promised to address the Flint issue after the election in endgame talks on separate water resource bill, but Democrats refused to take them at their word and pushed for Flint funding.

"'Trust me, we will consider Flint later' — that's like nothing to me," Pelosi said Tuesday.

Democrats say it's unfair that the water crisis in Flint has gone on for more than a year with no assistance, while Louisiana and other states are getting $500 million for floods that occurred just last month. Democrats have played a strong hand in the negotiations and know they have leverage because Republicans controlling the House and Senate are eager to avoid a politically harmful shutdown at midnight Friday.

"Democrats have been clear that Congress should not leave Flint and other lead-tainted communities out of any (stopgap spending) negotiation that includes emergency disaster funding," said Senate Minority Leader Harry Reid, D-Nev., and other top Democrats in a Tuesday morning letter to McConnell.

McConnell characterized the Democratic position as "no Flint, no flood" and indicated he is considering dropping the flood aid. Both sides hope to avert that.

The stopgap spending bill would keep the government running through Dec. 9 and provide $1.1 billion in long-delayed funding to fight the spread of the Zika virus and develop a vaccine and improved tests to detect it. Zika can cause can cause grave birth defects.

Fox News’ Chad Pergram and the Associated Press contributed to this report.