The US House of Representatives voted on Tuesday to revoke Donald Trump's declaration of a national emergency to build a wall on the US border with Mexico, handing the president a stinging rebuke on his signature issue.
In a 245-182 vote, the Democratic-majority House rejected Trump's assertion that he could use money for the wall that Congress had appropriated for other purposes. The bill now moves to the Republican-run Senate, where it also could pass, given some Republicans' concerns about the president's actions.
If approved in the Senate, Trump has already vowed to veto the measure.
Democratic leaders say the bill is not about the merits of Trump's wall, but how the president is trampling on the Constitution by grabbing money that he can't obtain through normal means.
Trump declared a national emergency on the southern border earlier this month after Democrats refused to give him more than $5bn in funds for the wall. Instead, Congress passed a spending measure that included nearly $1.4bn to build 55 miles (89km) of border barriers in Texas's Rio Grande Valley, ending a dispute that had led to a record 35-day partial shutdown of the government. The spending measure does not include money for a concrete wall, however.
House Speaker Nancy Pelosi said Trump's emergency "steals billions of dollars" from military construction projects - including possibly family housing and child care centres - to build the wall with Mexico.
Republicans counter that problems with drug runners and human trafficking give merit to Trump's manoeuvre.
The president took to Twitter on Monday to urge Senate Republicans to stick with him.
"I hope our great Republican Senators don't get led down the path of weak and ineffective Border Security," Trump wrote. "Without strong Borders, we don't have a Country - and the voters are on board with us. Be strong and smart, don't fall into the Democrats 'trap' of Open Borders and Crime!"
Senate Democratic leader Chuck Schumer said Trump is trying to "bend the law" with his declaration of a national emergency on the southern border. He called on politicians to "speak up with one bipartisan voice" to put a check on the executive branch as the founding founders envisioned.
"What would stop a future president from claiming an emergency every week?" he asked.
But Republican Senator John Kennedy, parrying those claims, said that he would "expect the next president, whether Democrat or not, would have a staff smart enough to know about the National Emergencies Act, and if the president wants to use it, he or she is going to use it no matter what past presidents have done".
On Monday, Republican Senator Thom Tillis said he would vote to block the order, joining Maine's Susan Collins and Alaska's Lisa Murkowski as Republicans supporting the resolution. Tillis added that Congress must defend its power of the purse and warned that a future Democratic president might abuse the power to advance "radical policies".
Another Republican, Senator Lamar Alexander, called Trump's order "unnecessary, unwise, and inconsistent with the United States Constitution and I'll decide how to vote when I'm presented with something to vote on".
Republican Senator Roy Blunt said there is "no disagreement there is a problem at the border that we are not dealing with adequately".
He added, "There is a vigorous discussion about whether the emergency actions really fall into a category where you would define something that had been out there for a long time and Congress had already voted on."
Senate voting on Trump's emergency order could drag under a rarely used procedure, which an aide said is possibly a first for the chamber. The law allows for up to 15 days of committee review - in this case, at the Armed Services panel - with a full Senate vote three days later. Senators, though, said the process could be expedited.
To override a presidential veto, Democrats would need 16 more Republican senators to join them, an unlikely event, giving Trump the upper hand.
"I don't think it will get here. It won't be overridden in the House," Senator John Cornyn, a Texas Republican, told reporters.
The wall was one of Trump's top campaign promises. He has long since dropped any pretence that money for the wall would come from Mexico, which he once claimed would be the source of funding.
Trump's declaration of a national emergency gives him access to about $3.6bn in funding for military construction projects to divert to border fencing. The Defense Department has not identified which projects may get cut.
But the administration is more likely to tap $600m from a federal asset forfeiture fund first. In addition, it is considering shifting more than $2bn from Defense Department accounts into a Pentagon counter-drug fund to be tapped for wall construction.
Trump's edict is also being challenged in the federal courts, where a host of Democratic-led states such as California have sued to overturn the order. Rights groups and landowners have also sued over the order.
With additional reporting by William Roberts in Washington, DC.