Trump will sign border bill, McConnell says, and declare national emergency Expect legal challenges to his national emergency.

In a surprise development Thursday, Senate Majority Leader Mitch McConnell announced on the Senate floor that President Donald Trump told him he would sign a border security funding bill that would avert a government shutdown, but also would declare a national emergency in order to get more funding for his proposed border wall.

McConnell's announcement caught Capitol Hill off guard. The Senate then voted to overwhelmingly approve the measure 83-16, sending it to the House for a vote late Thursday. The House approved the measure 300-128.

ABC News has learned the president plans to announce on Friday his intention to spend about $8 billion on the border wall with a mix of spending from Congressional appropriations approved Thursday night, executive action and an emergency declaration.

A senior White House official familiar with the plan told ABC News that $1.375 billion would come from the spending bill Congress passed Thursday; $600 million would come from the Treasury Department's drug forfeiture fund; $2.5 billion would come from the Pentagon's drug interdiction program; and through an emergency declaration: $3.5 billion from the Pentagon's military construction budget.

Many Republicans, including McConnell, had advised the president against declaring a national emergency, which is a challenge to Congress' "power of the purse" -- the power to decide how and where taxpayer money is spent. However, McConnell, in announcing the president's decision Thursday afternoon, said he now supported the move.

“I will fully support the enactment of a joint resolution to terminate the President’s emergency declaration, in accordance with the process described in the National Emergencies Act, and intend to pursue all other available legal options," Rep. Jerry Nadler, D-New York, the chairman of the House Judiciary Committee, said in a statement. "The Judiciary Committee will also use its authority to hold the Administration to account and determine the supposed legal basis for the President’s actions.”

Democrats and some Republicans came out against the president’s plans.

House Speaker Nancy Pelosi and Senate Minority Leader Chuck Schumer, in a joint statement, said the declaration would be a “lawless act” and a “gross abuse of the power of the presidency.”

"It is yet another demonstration of President Trump’s naked contempt for the rule of law," their statement said, calling it "a desperate attempt to put taxpayers on the hook" for his border wall, adding that Congress "will defend our constitutional authorities.”

In a statement late Thursday, Rep. Joaquin Castro, D-Texas, said, “If President Trump declares a national emergency to fund his border wall, I’m prepared to introduce a resolution to terminate the President’s emergency declaration.”

Sen. Susan Collins, R-Maine, said Thursday afternoon, "This approach does set a very bad precedent for future presidents, whether it's a Democrat or a Republican, to feel that they can get around Congress's constitutional role to allocate funding.

“It's very serious and troubling to me," she added.

Senior House Democrats and aides were waiting for Trump’s emergency declaration Thursday before deciding on how to best respond, but one aide said the House could take up and pass a joint resolution disapproving of any national emergency declaration -- a move that would force Republican senators to go on the record on Trump’s controversial move.

“We’re going to fight him,” Rep. Jim McGovern, D-Mass., the chairman of the House Rules Committee, said of Trump’s plans. “I think he’s going well beyond his constitutional powers, and he’s in for a hell of a fight.”

The spending deal crafted by top appropriators funding for the Department of Homeland Security and a handful of other federal agencies impacted by the 35-day government shutdown last month.

It includes $1.375 billion to build a physical barrier on the southern border – enough to construct about 55 miles of new fencing in new geographic areas, but less than the proposal rejected by the president late last year ahead of the shutdown.

It also includes hundreds of millions of dollars in funding for new border security and inspection technology at points of entry, and humanitarian relief, along with additional funding to increase the number of immigrant detention beds.

The increase in funding for the Department of Homeland Security and Immigration and Customs Enforcement, was enough for a handful of prominent progressive House Democrats to oppose the deal.

“We want to be abundantly clear: this is not a rebuke of federal workers or those who depend on the services they provide, but a rejection of the hateful policies, priorities, and rhetoric of the Trump Administration,” Reps. Alexandria Ocasio-Cortez, D-N.Y., Ayanna Pressley, D-Mass., Ilhan Omar, D-Minn., and Rashida Tlaib, D-Mich., said in a statement.

Hours later, Rep. Pramila Jayapal, D-Wash., a leader of the Congressional Progressive Caucus, also said she would vote against the deal.

“Congress must pass a strong DHS appropriations bill to bring accountability and humanity to our detention system. Unfortunately, this bill did not accomplish this and that is why I will vote no,” she wrote.

ABC News' Sarah Kolinovsky and Trish Turner contributed to this report.