The House early Friday morning passed a bipartisan bill to keep the government open, several hours into a partial government closure and despite division within both parties over the legislation.

Dozens of Republicans and Democrats voted against the bill, which provides government funding until March 23 and sets a marker for federal spending levels for the next two years. The legislation also suspends the nation’s borrowing limit for one year, and provides nearly $90 billion in disaster relief for states and territories devastated by recent wildfires and hurricanes.

Despite the opposition from Republicans opposed to new spending, and Democrats who wanted to include an immigration deal that doesn't exist, the bipartisan support supplied enough votes to ensure House passage.

Most Democrats added some drama by not voting until the very end, but more than 70 of them ultimately joined the GOP majority to support the bill. In the final vote, 67 Republicans rejected the bill, which passed 240-186.

House Speaker Paul Ryan, R-Wis., implored Democrats to help him pass the bill and keep the government open. He said that when Americans wake up Friday, "either Congress will have done it's most basic responsibility, funding the government... or they will see a second needless shutdown in a matter of weeks. Entirely needless."

The bill now heads to the White House, where President Trump’s signature later this will reopen the government before any real impact of the brief shutdown is felt.

The partial closure occurred at midnight, when a temporary funding measure expired. It marked the second time in two months that a spending fight shuttered parts of the government.

Republican and Democratic leaders planned to avert the shutdown by clearing the legislation Thursday night, but that plan was foiled by Sen. Rand Paul, R-Ky., who delayed the vote on the measure in the upper chamber until 1 a.m. Friday by refusing to allow the Senate to start earlier.

Paul slowed the timing of the vote in part to protest the deal to lift the budget caps, which were raised by $300 billion over two years.

He called for a vote on an amendment to restore the caps, but was denied because it would have opened up the legislation to endless amendments, both party leaders argued.

“What I’ve been arguing for is an open debate,” Paul said during a lengthy floor speech. “We are having all this spending, every last bit of spending has been thrown together in one bill and there is no reform. If we are not going to have an open debate, if it’s going to be take it or leave it, frankly I’ll leave it because I think my duty and what I told the American people was I care about how much debt we have accumulated as a country, and I think it’s dangerous.”

One Republican said Paul's move was a "colossal waste of time" that caused a brief but needless shutdown.

Overall, the bill calls for $700 billion for defense spending this year and $716 in fiscal 2019, adhering to a request by the Trump administration and congressional defense hawks who say the military has been damaged by budget cuts.

Many Democrats opposed the budget deal because it excludes a provision to protect from deportation so-called Dreamers who are part of an expiring Obama-era Deferred Action for Childhood Arrivals program, or DACA.

While Majority Leader Mitch McConnell, R-Ky., has promised to bring up an immigration bill next week, House Speaker Paul Ryan, R-Wis., hasn’t scheduled a vote on any immigration proposal. Without a political deal, no amount of legislative work is expected to result in any deal that can pass the House and Senate and be supported by Trump, but Democrats were pushing for floor work nonetheless.

“Speaker Ryan’s refusal to allow a bipartisan process for a DACA proposal demeans the dignity of the House of Representatives,” Minority Leader Nancy Pelosi, D-Calif., said in a letter to fellow Democrats Thursday announcing her opposition to the short-term spending bill. “It is also an insult to the American people, who overwhelmingly support the Dreamers.”

Pelosi pushed once more for an immigration deal on the House floor at 5 a.m. Friday.

"We strongly believe that members of the House and their constituents deserve the same dignity that Leader McConnell extended to members of the Senate," she said.

With passage of the short-term measure, Congress must now write and pass legislation to fund the remainder of the fiscal year beyond March 23 that adheres to the budget agreement. When written, the bill should provide $6 billion for communities to combat the opioid addiction crisis and $20 billion for infrastructure, which is a small downpayment on President Trump’s forthcoming plan to provide $1.5 billion in publicly and privately funded infrastructure improvements.

House Republicans who voted against the measure sided with Paul’s argument. The bill, opponent said, sends federal spending skyrocketing while green-lighting unlimited borrowing by the Treasury for the next year.

“This is nothing short of self-immolation through legislative malfeasance,” Rep. Andy Biggs, R-Ariz., wrote in a Fox News op-ed. “We are putting our grandchildren in an awful bind. If we cannot pass a budget and reduce the size of government now, we must wonder what kind of America they will see when they grow up. Will it be a thriving, free nation where they can fulfill their greatest aspirations, or will it be a broken and bankrupt country?”