WASHINGTON — The House prepared to take up the Senate-passed spending and border security bill Thursday evening as President Donald Trump announced he would sign the measure and then declare a national emergency to fund his wall.

The Senate overwhelmingly approved the $333 billion compromise measure, 83-16, which funds the Department of Homeland Security along with nine remaining federal departments through Sept. 30.

White House press secretary Sarah Sanders said in a statement that the president will take executive action, including invoking a national emergency, to stop what she characterized as a “national security and humanitarian crisis at the border.”

Democrats roundly criticized Trump’s plan with House Speaker Nancy Pelosi saying she “may” consider legal action.

Democratic Sens. Kamala Harris of California and Chris Coons of Delaware went further, calling a national emergency “ridiculous” and “a terrible idea,” respectively.

Some Senate Republicans also expressed dismay with the president’s decision. Sen. John Kennedy, R-La., was terse about the prospect of a national emergency.

“It’s not my preferred option,” he said prior to the final vote.

Sen. Susan Collins, R-Maine, was also displeased with the president’s choice. She said that a national emergency would undermine the appropriations process and Congress, and described it as “of dubious constitutionality.”

According to the Senate Appropriations Committee, the bill provides $22.54 billion for border security funding, with $1.375 billion reserved for 55 miles of physical barriers on the southwestern border. This is less than a quarter of the president’s initial demands for a $5.7 billion border wall.

The measure also funds the hiring of 600 new Customs and Border Protection officers, $100 million for technology at ports-of-entry and $400 million to address humanitarian issues at the border.

The bill also includes $3.64 billion in rural development, $12.6 billion in disaster relief and $21.5 billion for NASA.

The legislation does not include a limit on the number of detention beds Immigration and Customs Enforcement allocates for undocumented immigrants with a criminal history inside the United States. Democrats attempted to cap that number at 16,500 last week.

“Law enforcement can continue to detain people with criminal records who happen to be illegally in this country,” said Republican Sen. John Cornyn of Texas.

Among the 13 senators who voted against the bill were four of the five Democratic candidates for president. Only Sen. Amy Klobuchar of Minnesota broke from the pack of declared 2020 hopefuls. Four other potential candidates, including Independent Sen. Bernie Sanders, backed the measure.