The Senate early Friday morning passed legislation to keep the government open, nearly two hours after federal funding lapsed and a partial, but temporary, government shutdown took effect.

The bill funds the government through March 23, and Senate passage was set to be followed quickly by House passage before the effects of the shutdown were felt.

Most Democrats added some drama by withholding their vote 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, and it passed 240-186 — Trump was expected to sign it sometime Friday morning.

Aside from funding the government, the bill sets an increase in federal spending caps for the next two years — Congress was expected to use the next few weeks writing the spending bill that fits those caps. It also suspends the nation's borrowing limit for one year, allowing it to borrow whatever it wants.

Sen. Rand Paul, R-Ky., was among many House and Senate fiscal conservatives who oppose the plan’s steep increase in spending, specifically on the domestic side.

Paul demanded a vote on an amendment to reimpose the spending caps, but both Majority Leader Mitch McConnell, R-Ky., and Minority Leader Chuck Schumer, D-N.Y., told Paul it would result in a long string of amendments from other lawmakers if they opened up the floor to Paul’s request.

They urged Paul to consent to a vote hours earlier because of the approaching funding deadline, but Paul refused, arguing the 700-page deal was rushed and fiscally irresponsible.

“No one will read this bill,” Paul said. “Nothing will be reformed. The waste will continue and government will keep taking your money irresponsibly and added to a $20 trillion debt. There are no amendments being allowed. This is the most important debate we will have in the year over spending, and no amendments are allowed. We should have a full amendment process.”

Paul’s objection forced the vote until one hour after midnight.

The deal raises spending over 2011 Budget Control Act caps by $300 billion, spread over two years.

The caps are written into the March 23 spending bill, but will have to be appropriated in legislation that will be passed next month to fund the remainder of the fiscal year.

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 depleted by budget cuts.

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

While McConnell 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 agreement on immigration, nothing is expected to pass through Congress, but Democrats were still demanding some kind of House action.

“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. “It is also an insult to the American people, who overwhelmingly support the Dreamers.”

Before the Senate adjourned, McConnell set Senate debate on immigration legislation for Monday.