The US Congress passed a $1.1-trillion spending bill for fiscal year 2015 Saturday, capping a week of acrimonious wrangling while averting a government shutdown and sending the measure to President Barack Obama.
The bill, which narrowly cleared the House of Representatives on Thursday and survived a series of procedural hurdles to pass the Senate 56 votes to 40 during a rare weekend session, funds nearly all federal government agencies through next September.
But by funding the Department of Homeland Security until only February, it sets up a showdown over Obama's controversial immigration plan early next year, when a Congress under full Republican control will take another shot at rolling back the executive order shielding millions from deportation.
Despite the sometimes dramatic bickering between -- and within -- the two parties in the special session, the bill needed bipartisan cooperation to pass the Democratic-led chamber.
Senate Majority Leader Harry Reid said the bill was an imperfect but necessary compromise.
"Since 2011, Congress has lurched from crisis to crisis, with the country constantly under threat of a shutdown or financial catastrophe. It is a bad habit, and the American people are sick of it," he said.
Referring to America's tax and environment agencies, number two Senate Republican John Cornyn noted how the legislation "slashes spending for some of the president's most overreaching agencies like the IRS and EPA (and) blocks the administration's plan to transfer dangerous terrorists onto American soil" from the Guantanamo military prison.
Of the 40 no votes, 22 were Democrats, many of them furious that negotiators inserted deeply controversial policy riders into the package, including one that rolls back key financial regulations on Wall Street banks.
Another eviscerates parts of existing campaign finance law by allowing wealthy donors to contribute dramatically more money to political campaigns than currently allowed.
Democratic Senator Richard Blumenthal voted no, saying the package was "poisoned by special favors flagrantly contrary to the public interest."
The White House has indicated Obama will sign the bill.
The battle over funding has been a bruiser. It included a revolt by House Democrats that nearly sank the measure earlier this week, and procedural delay tactics in the Senate.
Congress needed to pass funding extensions twice in as many days to keep government from tumbling into a shutdown, as leaders struggled to get the funding across the finish line and bid farewell to the 113th Congress, one of the least productive sessions in modern history.
In the Senate, the measure survived a largely symbolic Republican challenge to Obama's immigration order.
Conservative firebrand Senator Ted Cruz brought a constitutional point of order against the plan, but it was rejected by a 22-74 vote.
Cruz, widely accused by Democrats of causing last year's 16-day government shutdown, appeared in no hurry to ease passage of the spending bill a day earlier, giving a fiery floor speech attacking congressional leaders for their failure to stand up to Obama's immigration order.
But the political tempest triggered by Cruz and fellow conservative Senator Mike Lee may have backfired, bringing criticism from several in their party.
It enabled Reid to launch a series of votes on Obama's nominees for judgeships and executive branch positions, some of them controversial.
"I haven't seen Harry Reid smile like this in years. I don't like it one bit," said Senator Lindsey Graham, who rued his party's "missteps" that allowed a vote on surgeon general nominee Vivek Murthy, whose nomination had been stalled by Republicans.
"It will have the end result of causing nominees whom I think are not well-qualified to be confirmed, so I don't understand the approach that he is taking, and I think it's very unfortunate and counterproductive," Senate Republican Susan Collins said of Cruz, according to The New York Times.
"This reminds me very much of the shutdown last year, where the strategy made absolutely no sense and was counterproductive."
The funding contains $1.014 trillion in discretionary domestic spending, plus $64 billion in military overseas contingency operations in Iraq, Afghanistan and elsewhere.
The measure provides $5 billion for operations to counter the Islamic State extremist group, and $5.4 billion in emergency funding was secured to respond to the Ebola crisis -- slightly less than the $6 billion Obama requested.