WASHINGTON (Reuters) - The U.S. Congress approved a stop-gap funding bill on Wednesday that averts a looming federal government shutdown and provides urgently needed money to help battle an outbreak of the Zika virus.

The United States Capitol Dome is seen before dawn in Washington March 22, 2013. REUTERS/Gary Cameron

Passage of the bipartisan legislation came shortly after Republicans and Democrats ended a months-long fight over whether Washington should provide aid to the city of Flint, Michigan, as it struggles with a crisis over contaminated drinking water.

Separate legislation was approved by the House of Representatives earlier in the day setting aid for Flint. It must now be reconciled with a somewhat different bill passed by the Senate.

The House voted 342-85 in a late-night session on Wednesday

to approve stop-gap funding to keep the U.S. government operating from Oct. 1, the start of the new fiscal year, until Dec. 9, when lawmakers will attempt to approve longer-term money.

With existing funds due to expire on Saturday, House Appropriations Committee Chairman Hal Rogers said the legislation “is a last resort, but at this point it is what we must do ... to keep the lights on in our government.”

The Senate voted 72-26 earlier on Wednesday to adopt the short-term spending bill.

Besides providing money to keep the government operating, the legislation also contains $1.1 billion to battle the Zika virus that has hit Puerto Rico hard and spread to U.S. states, most notably Florida.

The disease can cause severe birth defects. Funds would be used to develop a vaccine and reduce Zika exposure.

The bill also includes $500 million for flood relief in Louisiana and other states.

In a series of carefully orchestrated maneuvers after the Senate approved the temporary funding, the House passed a wide-ranging water resources bill containing $170 million to assist Flint by a vote of 399-25.

Democrats have demanded action on the crisis, which stems from dangerous levels of lead in Flint’s drinking water.

A Senate version of the bill contains $220 million for Flint and other cities with problem water systems.

The two chambers will have to hammer out compromise legislation after the Nov. 8 presidential and congressional elections. Wednesday’s flurry of activity in Congress came as lawmakers rushed to recess this week until after the elections.

Conservative groups urged Congress to defeat the funding bill. However, with House and Senate members facing an imminent deadline for approving new money and lawmakers eager to go home to campaign for re-election, the measure moved quickly through Congress on Wednesday.

The White House said it was disappointed that the temporary funding bill continued a provision barring the Securities and Exchange Commission from taking action to increase transparency in public companies’ political spending.

It also expressed disappointment that Congress failed to take steps to ensure that the Export-Import Bank was able to fully operate its loan guarantee programs.

Nevertheless, President Barack Obama is expected to sign the bill into law.