The House voted Tuesday to fund the Homeland Security Department through the end of the budget year, ending a protracted standoff that centered on objections to President Obama's controversial immigration actions.

The House voted 257-167 for the legislation, which includes no immigration provisions, and was carried over the finish line with mostly Democratic votes. In a statement late Tuesday, President Obama said he would sign the legislation as soon as it reached his desk.

"On behalf of the approximately 225,000 men and women of the Department of Homeland Security, we thank those in Congress -- Democrats and Republicans -- who voted for this bill and, in particular, those in Congress who showed the leadership necessary to get the job done," DHS Secretary Jeh Johnson said in a statement Tuesday afternoon.

The result is a victory for the Obama administration. Republicans had tried to use the DHS funding bill as the vehicle to reverse Obama's immigration executive actions. But Democrats repeatedly blocked the move, insisting they pass the spending bill with no riders attached.

House Speaker John Boehner, faced with diminishing options, earlier in the day told fellow Republican lawmakers he would drop the immigration demands.

More On This...

"I am as outraged and frustrated as you at the lawless and unconstitutional actions of this president," Boehner told his caucus on Tuesday morning, according to a source.

But he said he believed the decision to vote on a "clean" bill, "considering where we are -- is the right one for this team, and the right one for this country."

Boehner's move could lead to a backlash in the party, especially since House GOP leaders repeatedly denied claims that he struck a deal with Democratic Leader Nancy Pelosi last week to hold such a vote.

"This is the signal of capitulation," said Rep. Steve King, R-Iowa, earlier. "The mood of this thing is such that to bring it back from the abyss is very difficult."

But other Republicans welcomed Boehner's decision.

"Sanity is prevailing. I do give John Boehner credit," said Rep. Peter King, R-N.Y.

Short-term funding for the department was set to expire on Friday at midnight. Those voting for the final bill Tuesday included 182 Democrats and just 75 Republicans.

Boehner, according to sources, told his rank-and-file members that the only other options would be to allow DHS to undergo a partial shutdown, which he urged against considering the "active terror threats;" or to take up another stopgap funding bill, which he told lawmakers probably would not pass. Boehner blamed the impasse on Senate Democrats.

Congress has been caught in a procedural whirlwind over the past week as lawmakers tested various options for the DHS funding bill. After the effort to pass one stopgap funding bill melted down on the House floor last Friday, Congress approved a one-week funding bill in the final hours before a midnight deadline.

House Republicans, meanwhile, made a last-ditch effort to pursue immigration provisions by urging the Senate to join them in negotiating a compromise bill.

Senate Democrats blocked that effort on Monday.

Boehner told his caucus the fight against Obama's immigration orders would continue in the courts, which have suspended those actions for now. Obama's actions would spare millions of illegal immigrants from deportation.

Fox News' Chad Pergram and The Associated Press contributed to this report.