The House voted 236-191 to approve the legislation, which funds the Homeland Security Department through the rest of the budget year to the tune of $40 billion. But as part of that bill, Republicans added provisions to gut the president's immigration directives.
Despite deep Democratic opposition, the House voted 237-190 on an amendment to undo the actions Obama announced in November that provide temporary deportation relief, and offer work permits, to some 4 million illegal immigrants.
Another amendment would cancel Obama's 2012 policy that's granted work permits and stays of deportation to more than 600,000 immigrants who arrived in the U.S. illegally as kids. That measure passed more narrowly, 218-209, as more than two dozen Republicans joined Democrats in opposition.
Republicans say Obama's moves amounted to an unconstitutional overreach that must be stopped.
"We do not take this action lightly, but simply there is no alternative," House Speaker John Boehner said Wednesday. "It's not a dispute between the parties or even between the branches of our government. This executive overreach is an affront to the rule of law and to the Constitution itself."
But as the White House threatened a veto, Democratic leaders claimed the GOP provisions would hurt immigrant families -- and ultimately hurt Republicans politically.
"The amendments ... that the Republicans are tacking onto the bill, or at least trying to tack onto the bill, to keep the Department of Homeland Security open are inconsistent with our nation's values and its history. They would tear families apart," House Democratic Whip Steny Hoyer, D-Md., said.
Even with Republicans in control of the Senate the bill faces tough chances there, especially because House GOP leaders decided to satisfy demands from conservative members by including a vote to undo the 2012 policy that deals with younger immigrants known as "Dreamers." The amendment, which is opposed by some of the more moderate Republicans in the House, would ultimately expose those young people to deportation.
Security-minded lawmakers on both sides of the aisle also are worried about using the DHS funding bill to wage the immigration fight, saying security funding should not be put at risk, particularly in the wake of the Paris terror attacks. Current DHS funding expires at the end of next month.
In the Senate, Republicans would have to rally a 60-vote majority to advance the legislation, and they have only 54 members.
With even some Republicans voicing reservations, the Senate may have to strip out the immigration provisions and send a straight DHS funding bill back to the House, as the Feb. 27 deadline looms.
This, then, could set up another fight between GOP leadership and the conservative reaches of the party.
One senior House GOP aide told Fox News, "I don't know how this one ends."
Senate Democratic Leader Harry Reid, in a written statement, said the bill would not pass the Senate. "Republicans have only been in control for a week and already they are picking an unnecessary political fight that risks shutting down the Department of Homeland Security and endangering our security," he said, urging Republicans to pass a "clean" funding bill.
Some House Republicans acknowledged that the Senate is likely to reject their approach.
"They're not going to pass this bill," Rep. Charlie Dent, R-Pa., said in predicting the Senate outcome.
Obama has threatened to veto the House bill, and Democrats roundly denounced it, even as immigrant advocates warned Republicans they risked alienating Latino voters who will be crucial to the 2016 presidential election.
"Just two weeks into this new Congress, Republicans have turned a bipartisan issue, funding our Department of Homeland Security, into a cesspool of despicable amendments that cater to the most extremist anti-immigrant fringe," Rep. Ted Deutch, D-Fla., said in a House debate.
Fox News' Chad Pergram and The Associated Press contributed to this report.