Updated

Averting an election-year crisis, Congress late Wednesday sent President Barack Obama a bill to keep the government operating through Dec. 9 and provide $1.1 billion in long-delayed funding to battle the Zika virus.

The House cleared the measure by a 342-85 vote just hours after a bipartisan Senate tally. The votes came after top congressional leaders broke through a stalemate over aid to help Flint, Michigan, address its water crisis. Democratic advocates for Flint are now satisfied with renewed guarantees that Flint will get funding later this year to help rid its water system of lead.

The hybrid spending measure was Capitol Hill's last major to-do item before the election and its completion allows lawmakers to jet home to campaign to save their jobs. Congress won't return to Washington until the week after Election Day for what promises to be a difficult lame-duck session.

The bill caps months of wrangling over money to fight the mosquito-borne Zika virus. It also includes $500 million for rebuilding assistance to flood-ravaged Louisiana and other states.

The White House said Obama will sign the measure and praised the progress on Flint.

The temporary spending bill sped through the House shortly after the chamber passed a water projects bill containing the breakthrough compromise on Flint. The move to add the Flint package to the water projects bill, negotiated by top leaders in both parties and passed Wednesday by a 284-141 vote, was the key to lifting the Democratic blockade on the separate spending bill.

The deal averts a potential federal shutdown and comes just three days before deadline. It defuses a lengthy, frustrating battle over Zika spending. Democrats claimed a partial victory on Flint while the GOP-dominated Louisiana delegation won a down payment on Obama's $2.6 billion request for their state.

The politicking and power plays enormously complicated what should have been a routine measure to avoid an election-eve government shutdown.

The temporary government-wide spending bill had stalled in the Senate Tuesday over Democrats' demands that the measure include $220 million in Senate-passed funding to help Flint and other cities deal with lead-tainted water. Democrats were initially unwilling to accept promises that Flint funding would come after the election, but relented after they won stronger assurances from top GOP leaders like House Speaker Paul Ryan, R-Wis., and agreed to address the city's crisis in the separate water development bill.

The Flint issue arose as the final stumbling block after Senate Majority Leader Mitch McConnell, R-Ky., added the flood aid for Louisiana to the spending bill.

Democrats argued it was 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 played a strong hand in the negotiations and had leverage because Republicans controlling the House and Senate were eager to avoid a politically harmful shutdown six weeks before the election.

Behind-the-scenes maneuvering and campaign-season gamesmanship between Republicans and Democrats had slowed efforts to pass the temporary spending measure, once among the most routine of Capitol Hill's annual activities. A longstanding stalemate over Zika funding spilled on to the measure, which many GOP conservatives disliked because it guarantees a lame-duck session that's likely to feature post-election compromises that they'll oppose.

McConnell has made numerous concessions in weeks of negotiations, agreeing, for instance, to drop contentious provisions tied to Zika funding that led Democrats to block prior Zika measures. A provision to make Planned Parenthood ineligible for new anti-Zika funding for Puerto Rico was dropped, as was a provision to ease pesticide regulations under the Clean Water Act. Democrats relented on a $400 million package of spending cuts.

Many House Republicans have opposed helping Flint, arguing that the city's problems are a local issue and that many cities have problems with aging water systems.

Flint's drinking water became tainted when the city, then under state control, began drawing from the Flint River in 2014 to save money. Regulators failed to ensure the water was treated properly and lead from aging pipes leached into the water supply. As many as 12,000 children have been exposed to lead in water, officials say.

Democratic Rep. Dan Kildee, Flint's congressman, had accused Republicans of ignoring the plight of the predominantly black city after Republicans initially would not permit a vote.

But Wednesday morning Kildee issued a statement that called the upcoming vote on the non-binding, $170 million promise for Flint — an amendment in his name that's less generous than he originally asked for —"a step forward to ensuring that Flint families get the resources they need to recover from this crisis."

There were other winners and losers in the scramble to produce the legislation.

Democrats and some Republicans were thwarted in an attempt to allow the Export-Import Bank to approve export deals exceeding $10 million even though it lacks a quorum. Ted Cruz, R-Texas, failed to win a provision to block the U.S. government from transferring the Commerce Department's role in governing the internet's domain name addressing systems to a nonprofit consortium known as ICANN.

And Democrats failed to use the bill to reverse a ban engineered last year by McConnell on proposals to allow the Securities and Exchange Commission to require publicly-traded corporations to disclose political spending permitted under the Supreme Court's 2010 decision allowing unlimited political spending by businesses.

The spending bill also includes full-year funding for the Department of Veterans Affairs. That measure permits veterans with war injuries to receive in vitro fertilization treatments. A longtime ban on such treatments — demanded in the early 1990s by anti-abortion lawmakers concerned about destroyed embryos — has been lifted.