WASHINGTON — President Donald Trump will sign spending legislation to prevent a government shutdown while declaring a national emergency to try to build his proposed border wall, the White House confirmed Thursday. "President Trump will sign the government funding bill, and as he has stated before, he will also take other executive action — including a national emergency — to ensure we stop the national security and humanitarian crisis at the border," White House press secretary Sarah Huckabee Sanders said in a statement. It came before both chambers of Congress easily passed a measure to keep the government open past a midnight Friday deadline. "The President is once again delivering on his promise to build the wall, protect the border, and secure our great country," she added, as Trump prepared to approve legislation allocating about a quarter of the money he sought for barriers on the U.S.-Mexico border. If Trump follows through, lawmakers and the White House would dodge their second partial shutdown since December, sparing about 800,000 federal workers from more financial pain. But the emergency declaration could quickly spark lawsuits challenging the president's authority, creating yet another fight over his key campaign promise. Trump will speak in the White House Rose Garden after 10 a.m. ET on Friday on what the White House called the "national security and humanitarian crisis on our southern border." The president will announce he seeks $8 billion for wall construction, an administration official told NBC News. Along with the funds allocated by Congress, he aims to use $600 million from the Treasury's drug forfeiture fund, $2.5 billion from the Department of Defense's drug interdiction program and $3.5 billion from the military construction budget, according to NBC and ABC News. House Speaker Nancy Pelosi "may" file a legal challenge and will review her options, she told reporters Thursday. "Declaring a national emergency would be a lawless act, a gross abuse of the power of the presidency and a desperate attempt to distract from the fact that President Trump broke his core promise to have Mexico pay for his wall," she and Senate Minority Leader Chuck Schumer said in a statement Thursday. They added: "This is not an emergency, and the president's fearmongering doesn't make it one." The emergency declaration would allow Trump to redirect funds from other parts of the government to the project without congressional approval. The move could in part assuage conservative critics who argued the president should not accept the latest congressional plan, which denied him the funding he demanded for the border barrier. He had threatened the action for weeks, splitting the GOP caucus as some Republicans argued it would set a dangerous precedent. Trump repeatedly cast the emergency declaration as a decision rather than a necessity, which could weaken his legal case for the move.

President Donald Trump speaks during a briefing on Hurricane Michael in the Oval Office of the White House in Washington, DC, October 10, 2018. Saul Loeb | AFP | Getty Images

On Thursday, Senate Majority Leader Mitch McConnell first said Trump is "prepared to sign the bill" but would simultaneously declare a national emergency. The Kentucky Republican "indicated to [Trump] that [he is] going to support the national emergency declaration." His comments came amid confusion among Senate Republicans about how the party would move forward with the spending bill Thursday. McConnell broke into remarks from Sen. Chuck Grassley, R-Iowa, to make the announcement. Grassley angrily retorted, "I hope the next time I get a chance to have the floor, I won't be interrupted." Grassley is one of several Republicans who warned Trump against declaring a national emergency. Democratic leaders have also slammed the potential move as an executive overreach. They have also questioned whether it is necessary to address the flow of migrants at the southern border. "I think declaring a national emergency where this is no national emergency is not good for the president to do and is not good as a precedent," House Majority Leader Steny Hoyer, D-Md., told MSNBC shortly after McConnell spoke. The spending plan Congress aims to pass would put about $1.4 billion toward physical border barriers — short of the $5.7 billion Trump wants. It would specifically not allow construction of new wall prototypes proposed by Trump, putting money toward 55 miles of bollard fencing. The president has claimed the wall will still get built, even as Congress dealt him his latest defeat on a project he repeatedly promised to complete. Republicans and Democrats showed concerns about the spending plan, but congressional leaders from both major parties backed it. The GOP appeared to wait for Trump's support Thursday before voting, as the president waffled on whether to support the agreement Thursday. Senate Republicans looked eager to avoid the second partial government shutdown since December. Without a new spending plan, nine U.S. departments will run out of money at 12:01 a.m. ET Saturday. Funding for about a quarter of the government lapsed for 35 days during December and January. About 800,000 federal employees, furloughed or working without pay, missed two paychecks during the closure. Another shutdown threatened more financial hardship for those workers. Trump's demand for wall money, and Democrats' refusal to yield to him, led to the earlier shutdown. In December, Trump said he would "take the mantle" for the closure. Most Americans eventually did blame him for it, according to polls. Despite Congress' latest blow to his border wall plans, Trump has insisted he will build the wall regardless. He argues he has the authority to allocate funds from other parts of the government to construct it. "The bottom line is on the wall we're building the wall and we're using other methods other than this and in addition to this," Trump said during a Cabinet meeting Tuesday. The notion of an emergency split Republicans. While McConnell supported it Thursday, Sens. John Cornyn, R-Texas, Grassley and Marco Rubio, R-Fla., all criticized it in recent weeks. Earlier this month, Cornyn called it a "dangerous step." Last month, Rubio questioned whether the emergency declaration would hold up in court. He also said it is "not a good precedent." Asked Thursday whether the White House is concerned about the precedent the emergency declaration sets, Sanders responded: "Let's hope we don't have additional national security and humanitarian crises." The White House has identified $2.7 billion it could potentially redirect, according to Reuters. While it is unclear where the money would come from, Trump has previously suggested he could take it from the military.

Guards stand on the US side of the US-Mexico border fence as seen from Tijuana, Mexico, on November 16, 2018. PEDRO PARDO | AFP | Getty Images