Democratic leadership called Trump's plans to declare a national emergency a "desperate attempt to distract" from his failure to force Mexico to pay for the wall, as he's promised for years.

WASHINGTON — Congress lopsidedly approved a border security compromise Thursday that would avert a second painful government shutdown, but a new confrontation was ignited — this time over President Donald Trump's plan to bypass lawmakers and declare a national emergency to siphon billions from other federal coffers for his wall on the Mexican boundary.

Money in the bill for border barriers, about $1.4 billion, is far below the $5.7 billion Trump insisted he needed to build a wall along the Mexican boundary and would finance just a quarter of the 200-plus miles he wanted. The White House said he'd sign the legislation but act on his own to get the rest, a move that prompted immediate condemnation from Democrats and threats of lawsuits from states and others who might lose federal money or said Trump was abusing his authority.

Late Thursday night the White House announced an event in the Rose Garden for Friday 10 a.m. EST where the president will deliver "remarks on the national security and humanitarian crisis on our southern border."

The uproar over what Trump would do next cast an uncertain shadow over what had been a rare display of bipartisanship in Congress to address the grinding battle between the White House and lawmakers over border security.

The Senate passed the legislation 83-16, with both parties solidly on board. The House followed with a 300-128 tally, with Trump's signature planned Friday.

Both margins were above the two-thirds majorities needed to override presidential vetoes, though one wasn't expected and lawmakers sometime back a president of the same party in such battles.

Lawmakers exuded relief that the agreement had averted a fresh closure of federal agencies just three weeks after a record-setting 35-day partial shutdown that drew an unambiguous thumbs-down from the public. But in announcing that Trump would sign the accord, White House Press Secretary Sarah Sanders also said he'd take "other executive action, including a national emergency," prompting immediate condemnation from Democrats and threats of lawsuits from states that might lose federal money.

In an unusual joint statement, House Speaker Nancy Pelosi, D-Calif., and Senate Minority Leader Chuck Schumer, D-N.Y., said such a declaration would be "a lawless act, a gross abuse of the power of the presidency and a desperate attempt to distract" from Trump's failure to force Mexico to pay for the wall, as he's promised for years.

Pelosi and Schumer also said that "Congress will defend our constitutional authorities." They declined to say whether that meant lawsuits or votes on resolutions to prevent Trump from unilaterally shifting money to wall-building, with aides saying they would wait to see what he does.

Democratic state attorneys general said they would consider legal action to block Trump. Puerto Rico Gov. Ricardo Rossello told the president on Twitter "we'll see you in court" if he makes the declaration.

Despite widespread opposition in Congress to proclaiming an emergency, including by some Republicans, Trump is under pressure to act unilaterally to soothe his conservative base and avoid looking like he's surrendered in his wall battle.

The uproar over what Trump would do next cast an uncertain shadow over what had been a rare display of bipartisanship in Congress to address the grinding battle between the White House and lawmakers over border security.

The abrupt announcement of Trump's plans came late in an afternoon of rumblings that the volatile president — who'd strongly hinted he'd sign the agreement but never definitively — was shifting toward rejecting it. That would have infused fresh chaos into a fight both parties are desperate to leave behind, a thought that drove some lawmakers to seek heavenly help.

"Let's all pray that the president will have wisdom to sign the bill so the government doesn't shut down," Sen. Charles Grassley, R-Iowa, said after a chaplain opened Thursday's Senate session.

Moments before Sanders spoke at the White House, Senate Majority Leader Mitch McConnell, R-Ky., took to the Senate floor to announce Trump's decisions to sign the bill and declare an emergency.

Sen. John Cornyn, R-Texas, who is close to McConnell, told reporters that there were two hours of phone calls between McConnell and the White House before there were assurances that Trump would sign. In a surprising development, McConnell said he would support Trump's emergency declaration, a turnabout for the Kentucky Republican, who like many lawmakers had opposed such action.

Democrats say there is no crisis at the border and Trump is merely sidestepping Congress. And some Republicans warn that future Democratic presidents could use his precedent to force spending on their own priorities such as gun control. GOP critics included Maine Sen. Susan Collins, who said emergency declarations are for "major natural disasters or catastrophic events" and said its use would be of "dubious constitutionality."

White House aides and congressional Republicans have said that besides an emergency, Trump might assert other authorities that could conceivably put him within reach of billions of dollars. The money could come from funds targeted for military construction, disaster relief and counterdrug efforts.

Congressional aides say there is $21 billion in military construction money that could potentially be used by Trump if he declares a national emergency. But according to the law the money has to be used in support of U.S. armed forces, they say.

The Defense Department declined to provide details on available money.

With many of the Democrats' liberal base voters adamantly against Trump's aggressive attempts to curb immigration, four declared presidential hopefuls opposed the bill in the Senate: Cory Booker of New Jersey, New York's Kirsten Gillibrand, Elizabeth Warren of Massachusetts and Kamala Harris of California. Amy Klobuchar of Minnesota voted for it, as did Vermont independent Bernie Sanders, who is expected to join the field soon.

Notably, the word "wall," the heart of many a chant at Trump campaign events and his rallies as president, is absent from the compromise's 1,768-page legislative and descriptive language. "Barriers" and "fencing" are the nouns of choice, a victory for Democrats eager to deny Trump even a rhetorical victory.

The agreement, which took bargainers three weeks to strike, would also squeeze funding for Immigration and Customs Enforcement, or ICE, in an attempt to pressure the agency to detain fewer immigrants. To the dismay of Democrats, however, it would still leave an agency many of them consider abusive holding thousands more immigrants than last year.

Provisions like that were prompting some of the most liberal Democrats to vote "no." Four progressive freshmen including Rep. Alexandria Octavio-Cortez, D-N.Y., said they were opposing the agreement to show "a rejection of the hateful policies, priorities, and rhetoric of the Trump Administration."

The measure contains money for improved surveillance equipment, more customs agents and humanitarian aid for detained immigrants. The overall bill also provides $330 billion to finance dozens of federal programs for the rest of the year, one-fourth of federal agency budgets.

Trump sparked the last shutdown before Christmas after Democrats snubbed his $5.7 billion demand for the wall. The closure denied paychecks to 800,000 federal workers, hurt contractors and people reliant on government services and was loathed by the public.

With polls showing the public blamed him and GOP lawmakers, Trump folded on Jan. 25 without getting any of the wall funds. His capitulation was a political fiasco for Republicans and handed Pelosi a victory less than a month after Democrats took over the House and confronted Trump with a formidable rival for power.

Trump's descriptions of the wall have fluctuated, at times saying it would cover 1,000 miles of the 2,000-mile boundary. Previous administrations constructed over 650 miles of barriers.

___