WASHINGTON, DC - FEBRUARY 05: The U.S. Capitol Building  on February 5, 2019 in Washington, DC. President Trump delivers his State of the Union address tonight in Washington, a week after Speaker of the House Nancy Pelosi withdrew her initial invitation because of the partial government shutdown. (Photo by Zach Gibson/Getty Images)
WASHINGTON, DC - FEBRUARY 05: The U.S. Capitol Building on February 5, 2019 in Washington, DC. President Trump delivers his State of the Union address tonight in Washington, a week after Speaker of the House Nancy Pelosi withdrew her initial invitation because of the partial government shutdown. (Photo by Zach Gibson/Getty Images)
PHOTO: Zach Gibson/Getty Images North America/Getty Images
Now playing
00:47
Senate approves spending bill to avoid shutdown
US President Joe Biden delivers remarks before signing an Executive Order in the South Court Auditorium at the White House on January 25, 2021 in Washington, DC. (Photo by JIM WATSON / AFP) (Photo by JIM WATSON/AFP via Getty Images)
US President Joe Biden delivers remarks before signing an Executive Order in the South Court Auditorium at the White House on January 25, 2021 in Washington, DC. (Photo by JIM WATSON / AFP) (Photo by JIM WATSON/AFP via Getty Images)
PHOTO: Jim Watson/AFP/Getty Images
Now playing
02:50
Biden thinks US can get to 1.5 million vaccine doses daily
TAMPA, FL - AUGUST 29:  U.S. Sen. Rob Portman (R-OH) waves during the third day of the Republican National Convention at the Tampa Bay Times Forum on August 29, 2012 in Tampa, Florida. Former Massachusetts Gov. Former Massachusetts Gov. Mitt Romney was nominated as the Republican presidential candidate during the RNC, which is scheduled to conclude August 30.  (Photo by Mark Wilson/Getty Images)
TAMPA, FL - AUGUST 29: U.S. Sen. Rob Portman (R-OH) waves during the third day of the Republican National Convention at the Tampa Bay Times Forum on August 29, 2012 in Tampa, Florida. Former Massachusetts Gov. Former Massachusetts Gov. Mitt Romney was nominated as the Republican presidential candidate during the RNC, which is scheduled to conclude August 30. (Photo by Mark Wilson/Getty Images)
PHOTO: Mark Wilson/Getty Images
Now playing
02:16
GOP senator explains why he won't seek reelection
diegal
diegal
PHOTO: CNN
Now playing
02:58
Former Republican: We've got a bankrupt party
Now playing
02:26
See Biden sign executive order lifting transgender military ban
WASHINGTON, DC - AUGUST 10:  The Trump International Hotel is shown on August 10, 2017 in Washington, DC.  The hotel, located blocks from the White House, has become both a tourist attraction in the nation
WASHINGTON, DC - AUGUST 10: The Trump International Hotel is shown on August 10, 2017 in Washington, DC. The hotel, located blocks from the White House, has become both a tourist attraction in the nation's capital and also a symbol of President Trump's intermingling of business and politics. (Photo by Win McNamee/Getty Images)
PHOTO: Win McNamee/Getty Images
Now playing
01:56
Why SCOTUS is dismissing emolument cases against Trump
PHOTO: CNN
Now playing
02:20
Legal analyst: Dominion's case looks pretty strong
John Avlon 0125
John Avlon 0125
PHOTO: CNN
Now playing
03:08
Avlon: The Republicans who stood up to Trump were our bulwark
Now playing
03:19
Some GOP lawmakers are defying Capitol security measures
PHOTO: CNN
Now playing
01:17
Sen. Romney: Senate trial after Trump leaving office is constitutional
PHOTO: CNN
Now playing
03:25
Biden's HHS secretary pick: If we do this, we will get the pandemic under control
Now playing
07:26
'What research did you do?': Brown presses GOP lawmaker on election fraud claims
PHOTO: CNN
Now playing
01:42
Acosta describes covering last day of Trump administration
WASHINGTON, DC - FEBRUARY 06: Rep. Alexandria Ocasio-Cortez (D-NY) attends a press conference with Rep. Andy Levin (D-MI) about their new bill called the EV Freedom Act on Capitol Hill on February 6, 2020 in Washington, DC. The EV Freedom Act is a plan to create a nation wide charging infrastructure for electric vehicles. (Photo by Samuel Corum/Getty Images)
WASHINGTON, DC - FEBRUARY 06: Rep. Alexandria Ocasio-Cortez (D-NY) attends a press conference with Rep. Andy Levin (D-MI) about their new bill called the EV Freedom Act on Capitol Hill on February 6, 2020 in Washington, DC. The EV Freedom Act is a plan to create a nation wide charging infrastructure for electric vehicles. (Photo by Samuel Corum/Getty Images)
PHOTO: Samuel Corum/Getty Images
Now playing
03:35
Rioter charged with threatening to 'assassinate' Ocasio-Cortez, officer
Now playing
02:41
Loyal Texas Trump voters want Biden to be less divisive
Now playing
01:16
Sen. Patrick Leahy doubles as a Batman actor
(CNN) —  

With little more than a day left before funding expires for key parts of the government, the House and Senate both voted on Thursday to approve a spending deal to avert a shutdown, sending the legislation to the White House for President Donald Trump’s signature.

The House vote, which took place late Thursday evening, was 300 to 128. The Senate vote, which took place earlier in the day, was 83 to 16.

After weeks of uncertainty over whether the President would accept a bill that did not meet his demand for $5.7 billion in border wall funding, the White House announced on Thursday that the President would sign the compromise legislation, but will also take executive action in a bid to get the money the administration wants for border security.

The compromise deal will only provide $1.375 billion for border barriers, far short of what the President has asked for to build his long-promised border wall.

When the President signs the spending measure into law, it will bring to a close weeks of fighting between congressional Democrats and the White House and Republican lawmakers over border security, a dispute that triggered the longest government shutdown in US history when funding for roughly a quarter of the federal government lapsed as a result of the standoff in December.

The 35-day long shutdown that resulted did not end until January, when the President signed a three-week stop-gap measure to temporarily reopen the government and allow for negotiations over border security.

Signing the legislation will amount to a concession from the President that Congress is not willing to meet his demand for border wall funding, but it will not be the end of a contentious debate over border security if Trump invokes a national emergency. A national emergency declaration is expected to face legal challenge and will face fierce pushback from congressional Democrats, especially in the Democratic-controlled House.

An emergency declaration will also test Republican unity on Capitol Hill with some Republican lawmakers already expressing concern Thursday.

Senate Majority Leader Mitch McConnell announced the President’s intention to declare a national emergency before the White House did, saying in remarks on the Senate floor before the chamber voted on the legislation that he spoke with the President and that, while Trump is prepared to support the deal, “he will also be issuing a national emergency declaration at the same time.” McConnell also said that he would support such a declaration.

McConnell was forced to back a move he’s raised concerns about, both publicly and privately, aides say, in order to secure Trump’s support, a significant concession but one that appeared necessary to receive the President’s public assurances that he’ll sign the bill. In the hours leading up to the vote, the President phoned GOP allies on Capitol Hill to ask their advice and vent at some of the bill’s shortcomings, leading many to believe he was backing away from his earlier support of the compromise spending legislation, according to people familiar with the calls.

House Speaker Nancy Pelosi and Senate Minority Leader Chuck Schumer, meanwhile, issued a sharp rebuke of the proposed move on Thursday, in a sign of that kind of opposition the President will face if he invokes a national emergency.

In a joint statement, the top congressional Democrats said that “declaring a national emergency would be a lawless act” and “a gross abuse of the power of the Presidency.” The statement from the two Democratic leaders said that “Congress will defend our constitutional authorities” in the event of a national emergency.

During a news conference earlier in the day, Pelosi also warned that if Trump declares a national emergency he will be setting a precedent that could backfire on Republicans in the future.

“A Democratic president can declare emergencies as well,” Pelosi said. “So the precedent the President is setting here is something that should be met with great unease and dismay by the Republicans.”

Lawmakers on both sides of the aisle did indeed react with uneasy and dismay on Thursday.

Democratic House Judiciary Chair Jerry Nadler said in a statement that he would “support the enactment of a joint resolution to terminate the President’s emergency declaration,” and that he plans “to pursue all other available legal options.”

Republican Sen. Rand Paul of Kentucky suggested it was a “bad idea.”

“Clearly I have concerns about using this declaration for this set of circumstances,” said Sen. Roy Blunt, a Missourian and a member of GOP leadership. “Let’s see what he does.”

“I generally don’t think it’s a good idea,” added Sen. Marco Rubio of Florida.

On the Democratic side, Sen. Kamala Harris, a 2020 presidential candidate from California, said, “I think it’s ridiculous.”

The full legislative text of the deal was released just after midnight Thursday, paving the way for both chambers to vote on the plan that funds 25% of the federal government, including the Department of Homeland Security, ahead of a Friday at midnight government funding deadline.

This story has been updated with additional developments Thursday.

CNN’s Manu Raju, Phil Mattingly, Ted Barrett, Alex Rogers and Ashley Killough contributed to this report.