WASHINGTON -- In a quick and unannounced move late Friday, the Senate passed a one-week extension of funding for the Department of Homeland Security, an attempt to avert a shutdown set to take effect at midnight. The continuing resolution then cleared the House, where earlier in the day Republican leadership failed to get enough support to pass a three-week stopgap measure.

The House voted 357-to-60 to pass the one-week funding extension, which required a super majority in order to speed passage before the midnight deadline. Congressional leaders now have one week to find a way to prevent another shutdown crisis.

The ongoing fight over DHS funding has been bogged down by Republican efforts to block President Barack Obama’s executive orders on immigration. The House GOP tried to reverse Obama’s actions by tying an immigration reform rollback to the funding for DHSBut that plan fell apart when the measure reached the Senate. Democrats blocked consideration of the bill until Senate Majority Leader Mitch McConnell and Minority Leader Harry Reid agreed to strip the immigration changes out of the bill.

House Republicans were unwilling to go along with the Senate changes, which passed with bipartisan support. Instead, they attempted to pass a three-week stopgap to give them leverage to pressure Democrats again. That bill was killed on the House floor in a dramatic vote that saw Democrats and conservative Republicans join forces against the GOP leadership. It was a devastating blow to Republican leaders who have struggled to get their members to coalesce behind important pieces of legislation.

House Speaker John Boehner and his leadership team worked into the night to try to round up enough support to pass a one-week extension and stave off the shutdown. With the House still in recess and leadership still huddling in Boehner’s office, the Senate opted to act first.

McConnell and Reid quickly took the Senate floor a little before 8:30 p.m. to pass the stopgap measure. The two leaders were able to pass the bill using a process known as unanimous consent, meaning no one on the floor objected so it was allowed to pass without a full vote.

The House voted drew opposition only from the most conservative Republicans. Democrats had joined with the conservatives to defeat the three-week funding stopgap. But facing a nearing deadline, Democrats voted overwhelmingly for the one-week measure.

Conservative Republicans generally voted against the extension, still frustrated at their inability to force a showdown with President Obama over immigration.