U.S. House of Representatives Speaker John Boehner is attempting to avoid an intra-Republican battle over how to fight President Barack Obama's immigration executive actions, while also funding the Department of Homeland Security. Alex Wong/Getty Images

WASHINGTON -- This was the fight Republicans wanted. They laid the plans in December: Withhold funding for the Department of Homeland Security and then, using the DHS budget as leverage, force President Barack Obama to reverse his immigration executive orders.

What Republicans didn’t plan on was having a battle among themselves instead of with the White House.

The House of Representatives passed a bill that would keep Homeland Security funded beyond the Feb. 27 deadline while also undoing all the president's immigration rulings, including giving legal status to so-called Dreamers. But, after three tries, Senate Democrats have held on to a filibuster and blocked the bill.

Now the GOP can’t seem to find or agree on an endgame. Conservatives remain determined to undo the immigration orders, period. But cutting off funding for the department tasked with protecting the U.S. from terrorism would be politically dicey at any time and particularly hard to defend at a moment when Islamic State group militants are willing to burn anti-ISIS coalition captives alive.

In truth, the debate over DHS funding is more about optics than anything operational. The department won’t actually close its doors and go home to wait for Congress to pass a funding bill -- or for terrorists to strike. Most of its functions are considered essential: Employees will still have to report to work. But they will have to wait until Congress restores their funding to get their paychecks. It would take a long-term stalemate to start causing real problems in areas such as hiring and purchasing equipment.

Both chambers of Congress headed home Thursday without a resolution. And with a brief recess scheduled for the week of Presidents Day, Congress has only eight working days left before DHS funding runs out.

Asked Thursday whether he knows what Senate Majority Leader Mitch McConnell might do, House Speaker John Boehner was straightforward. “No,” he said, drawing laughter from the press. “Listen, he’s got a tough job over there. I’ve got a tough job over here. God bless him and good luck,” Boehner said, drawing more laughter from the reporters. “What else can you say?”

And as much as Republicans will insist the next few weeks that the “tough job” is standing up to Democrats, it’s really about attempting to settle the intra-GOP dispute. A number of Republicans -- including Sens. John McCain, Dean Heller and Susan Collins -- appear willing to back away, to fund Homeland Security without tying it to immigration-reform rollbacks. But the party’s right wing refuses to give in.

It’s a near-repeat of the lead-up to the federal government shutdown in October 2013. House conservatives pushed for a fight with Obama by attaching a defunding of the Affordable Care Act to a spending bill, considered “must pass.” But the groups pushing for the fight were never able to explain how they would win. And after the bill got bogged down in the Senate, they had no idea what to do next. A 17-day shutdown of the entire government ensued.

This time, Republicans control the Senate. But without 60 votes, it makes little difference.

The GOP is trying to make this mess look like the Democrats’ fault, saying the Democrats oppose the bill because they don’t want to fund DHS -- neglecting to mention the immigration factor.

“We’ve got a bill that fully funds the Department of Homeland Security. In fact, it’s an increase over last year’s funding. It funds every portion of it,” Sen. Pat Toomey, R-Pa., said when asked what Republicans do next. “I think the American people are going to demand that the Democrats actually take up the bill.”

But blaming the Democrats is going to be a hard sell. For all the speeches Republicans gave in 2013 calling it a Democratic shutdown, the public didn’t buy it. Polls found voters overwhelmingly blamed the GOP.

Another factor at play is that since Republicans took control of the House, they have never managed to pass a spending bill that became law without the help of Democratic votes. If Boehner ultimately gives up the immigration attack and tries to pass a bill that simply funds DHS, he would likely need almost every Democrat to vote for it. That would allow Democrats to claim to be the ones who broke the stalemate.

The whole episode is undermining the GOP leadership’s goal of showing voters that the party can govern. Boehner and McConnell are left to juggle competing interests. Neither wants to see DHS shut down. And neither wants to see a revolt by their conservative members.

After a back and forth exchange on the Senate floor Thursday morning with Senate Minority Leader Harry Reid, McConnell sounded near exhaustion. “There is a bipartisan desire to fund the Department of Homeland Security, and I’m sure we’ll figure this out sometime in the next few weeks,” McConnell said.

But his -- and Boehner’s -- bafflement hardly created an image of leadership. Boehner’s weary shrug and lack of answers were ripe for a Democrat vine.