By Richard Cowan and Amanda Becker
WASHINGTON (Reuters) - Legislation to stave off an imminent federal government shutdown encountered obstacles in the U.S. Senate late on Thursday, despite the passage of a month-long funding bill by the House of Representatives hours earlier.
Without the injection of new money, no matter how temporary, scores of federal agencies across the United States will be forced to shut starting at midnight Friday, when existing funds expire.
The Republican-controlled House approved funding through Feb. 16 on a mostly partisan vote of 230-197, sending the stopgap bill to the Senate for consideration as President Donald Trump pushed hard for a measure to sign before Friday's deadline.
However, a mix of Democrats and Republicans in the Senate who oppose the House bill for varying reasons left the legislation on the verge of defeat.
A bitter fight broke out on the Senate floor shortly after the House passage and was expected to continue on Friday.
That fueled speculation that Washington would either be thrown into shutdown mode or Congress would merely pass a very short spending bill - possibly for no more than a few days - to give lawmakers more time to negotiate.
Hovering over the government funding fight are November's congressional elections, in which one-third of the 100-member Senate and all 435 House seats are up for grabs as Republicans battle to keep control of both chambers.
Complicating the effort was a demand by Democrats to attach an immigration measure to the funding bill to protect a large group of young, undocumented immigrants, known as "Dreamers."
Trump has meanwhile continued to push to build a wall along the U.S. border with Mexico that many lawmakers do not want as part of any immigration deal.
With that as a backdrop, Republican and Democratic leaders were already casting blame on each other for a shutdown that was still not a certainty.
"Senator Schumer, do not shut down the federal government ... It is risky. It is reckless. And it is wrong," House Speaker Paul Ryan said in a statement, referring to Senate Democratic Leader Chuck Schumer.
Senator Patrick Leahy, the senior Democrat on the Senate Appropriations Committee, issued a statement accusing Republicans of angling for a shutdown.
"President Trump wants to shut down the government over his cynical and misbegotten 'big beautiful wall,' which will be paid for by U.S. taxpayers, NOT Mexico," Leahy said.
Senate Majority Leader Mitch McConnell said Democrats were aiming to "hold the entire country hostage" by demanding that a "non-imminent problem" related to immigration be resolved immediately.
Democrats want to put the Dreamers, a group of people brought into the U.S. illegally as children, onto a pathway to citizenship and protect them from deportation.
Trump said in September he was ending former President Barack Obama's Deferred Action for Childhood Arrivals (DACA) program shielding around 700,000 Dreamers, who are mostly from Mexico and Central America. Trump set a March 5 deadline for Congress to write legislation to protect them.
However, Democrats have argued that an average of 122 Dreamers a day have been losing their DACA protections since September, leaving them in limbo.
Schumer, responding to McConnell, said: "We all know what the problem is. It's complete disarray on the Republican side," referring to conflicting immigration demands floated over the past several months by the Trump administration.
McConnell has said he would not take up an immigration bill until it was clear what Trump would sign. The president rejected a bipartisan Senate compromise last week after saying he would support one in theory.
Instead of passing a month-long patch to government spending, Schumer proposed a "very short-term" bill to keep the government running, which he said could spark a deal over the next few days on immigration and overall spending levels through Sept. 30, the end of this fiscal year.
Democratic Senator Dick Durbin, who is leading the fight on behalf of Dreamers, met a teary-eyed group of the youngsters in his offices as the Senate wrapped up its work for the night.
He later told reporters that a high-level bipartisan meeting earlier on Thursday had showed signs of promise.
Durbin said the negotiators "finally started talking about real issues, Dream Act citizenship and border security in more specific terms."
House passage came only after conservatives secured a promise from Ryan that he would soon advance some type of legislation to bolster U.S. military readiness, satisfying their desire for increased defense spending, said Republican Representative Mark Meadows, head of the House Freedom Caucus.
The 2018 fiscal year began on Oct. 1. Congress' inability to agree on overall funding levels has meant that the government has been operating on a series of temporary measures that mainly kept spending at the previous year's levels.
Besides extending government funding for a month to give negotiators more time to work on a longer deal, the House's temporary spending bill would extend the Children's Health Insurance Program (CHIP) for low-income families for six years.
Republicans inserted the measure in a move partly to lure Democratic support.
(Reporting by Richard Cowan and Amanda Becker; Editing by Peter Cooney and Paul Tait)