Bebeto Matthews/AP

Updated February 28, 11:10 a.m.

The Department of Homeland Security will stay open for at least another week after the House and Senate approved a short extension of funding late Friday night. President Obama signed the stopgap measure, which goes through March 19, just minutes before a partial shutdown of the department was to take effect at midnight.

Passage of the bill came hours after House Republicans failed to clear a three-week extension of funding. Conservatives opposed its lack of restrictions on Obama's immigration policy, while Democrats were holding out for a full-year DHS budget. Now the fight will go on for at least one more week.

Updated February 27, 2015, 6:40 p.m.

Congress couldn't even manage to kick the can down the road.

After a lengthy standoff between House and Senate Republican leaders, it looked like the Department of Homeland Security would be funded after all—a victory for President Obama, and an embarrassing defeat for Republicans. Since late 2014, GOP members of Congress hoped to use DHS funding as leverage to force Obama to reverse executive actions that ended deportations for undocumented immigrants.

On Friday, everything came to a head. The Senate, unable to pass a bill that would fund DHS while blocking the immigration actions due to a Democratic filibuster, passed a "clean" bill that funded the department for the rest of the year. It was the House's move, but Speaker John Boehner and Republican leaders opted to try for a short-term measure that would provide three weeks of funding.

Their gambit failed. With 50 Republicans voting against leadership and just 12 Democrats going for the measure, the bill failed with a vote of 224 to 203.

By 6 p.m. Friday, the endgame for congressional leaders was unclear. Boehner's team could bring a shorter-term extension to the floor and hope it attracts more votes. It could also admit defeat and simply bring up the "clean" extension for a vote, relying on Democrats to pass the bill. That would be a serious violation of the "Hastert rule," an unofficial House GOP practice that says no bill should pass without a majority of the majority, and it seems clear that a majority of the GOP caucus wouldn't back it—though a majority of the House likely would.

Republican leaders could also simply do nothing and let Homeland Security temporarily shut down when its funding lapses at midnight Friday. As our colleague Noah Gordon noted this week, the immediate effects of a shutdown might not be obvious to most Americans, and presumably a funding solution would be worked out promptly.

The Friday fracas is another blow to Boehner, who was repeatedly contended with an unruly conservative wing determined to wreck plans. In this case, he seems to be following a path he's used before: Give the conservatives their chance, vote on whatever methods they think will work, and show them it won't work. Once they've exhausted all other options, they'll go along with the clean raise. That's likely what will happen here, too; the questions are when that happens and what sort of blowback Boehner will receive for breaking the Hastert rule.

All in all, it was an embarrassing week for the Republican majority, which found itself in a legislative battle it couldn't win and facing a shutdown scenario its leaders swore wouldn't happen. Boehner faced opposition from conservatives who pushed him to resist any concessions on immigration, while moderates were angry that the party was jeopardizing national security and risking rebuke from voters who would blame the GOP for a shutdown. Adding to Boehner's troubles, conservatives also forced the leadership to scrap a vote on a separate education bill on Friday overhauling the No Child Left Behind Act. The failures are particularly stinging for Republicans because they come shortly after the party took over both houses of Congress, promising that unified control would allow them to govern more effectively.

Democrats, meanwhile, were simply exasperated. "Get a grip, Mr. Speaker. Get a grip," the House minority leader, Nancy Pelosi, said at an afternoon news conference. Yet Boehner would not give up on the immigration issue, and after twice delaying action so he could round up more votes, he failed to win passage of the three-week extension. The GOP is hoping to engage Democrats in negotiations over the longer DHS bill, but Democrats and the White House say they won't accept anything that overturns the president's immigration policy (which has already been blocked, temporarily, by a federal judge in Texas).

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.