WASHINGTON (Reuters) - In a stinging rebuke to President Donald Trump, the House of Representatives on Tuesday brushed aside veto threats and passed legislation to terminate the emergency he declared at the U.S.-Mexico border in order to build a wall there.

By a vote of 245-182, the House passed the resolution, setting up a vote in the Republican-controlled Senate where the resolution’s chances were slimmer, but seemed to be improving.

While passage was a victory for Democratic House Speaker Nancy Pelosi, the tally was short of what she would likely need to override a possible veto by Republican Trump. Only 13 Republicans supported the move to stop the president’s declaration.

During floor debate, Democratic Representative Joaquin Castro, the main sponsor of the controversial legislation, said, “There is no emergency at the border,” adding, “Border crossings are at a four-decades low.”

Democrats and some Republicans worry that with the emergency declaration unilaterally funding his border wall without lawmakers’ approval, Trump was presenting a dangerous challenge to the constitutional balance of powers between Congress and the executive branch of government.

Hours before the House vote, Republican Senator John Barrasso, a member of the Senate’s leadership, told MSNBC in an interview that the legislation “may actually pass the Senate.”

Following a closed meeting of Republican senators and Vice President Mike Pence, Senate Majority Leader Mitch McConnell refused to predict the outcome, including whether senators ultimately could override a Trump veto.

McConnell said Republican senators and Pence held a “robust, vigorous discussion” and that he had not “reached a total conclusion” over whether Trump’s emergency proclamation was legal.

Meanwhile, the White House formally notified Congress, as expected, that if the measure passes Congress, Trump’s advisers would recommend that he veto it in order to maintain the power he activated on Feb. 15 as a way of circumventing Congress.

Slideshow ( 8 images )

Trump argues he has the power to proclaim a national emergency to unilaterally direct existing money for building a border wall that Congress has refused to fully fund.

“The current situation at the southern border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency,” the White House statement said.

A Trump veto would be the first of his presidency and the first since Republicans lost majority control of the House in last November’s congressional elections.

Overriding such a veto in Congress would require two-thirds majorities in both chambers, making it highly unlikely, said lawmakers.

The battle in Congress is the latest chapter in a long-running war between Trump and Democrats over border security, immigration policy and the “great, great wall” that Trump has pledged to build since becoming a presidential candidate.

He originally promised that Mexico would pay for it, but after Mexico refused, he asked U.S. taxpayers to foot the bill for a project Democrats say is unneeded and will not be effective.

In his first two years in office, Trump’s Republicans controlled both chambers of Congress, which under the U.S. Constitution holds the national purse strings.

During that time they failed to appropriate all the money Trump was seeking to build a wall. This year, with Democrats in control of the House, Congress refused Trump’s demand for $5.7 billion in wall funding. Instead, he got $1.37 billion for border barriers this fiscal year.

Slideshow ( 8 images )

Angry over that decision, Trump declared the emergency and vowed to divert funds toward the wall from accounts already committed by Congress for other purposes.

On a separate track from Congress, the future of Trump’s emergency declaration is also likely to be litigated in the courts.

A coalition of 16 U.S. states led by California has already sued Trump and top members of his administration to block his emergency declaration.

Writing on Twitter on Monday, Trump, who says the wall is needed to stop illegal immigration and drugs, warned Republicans not to “fall into the Democrats ‘trap’ of Open Borders and Crime!”

Republican Representative Justin Amash was the lone Republican co-sponsoring the resolution in the House.

“The same congressional Republicans who joined me in blasting Pres. Obama’s executive overreach now cry out for a king to usurp legislative powers,” Amash wrote on Twitter.

The White House was working to limit Republican support for the measure, especially in the Senate.

Nevertheless, Republican Senator Thom Tillis, in an opinion article published in the Washington Post, said he backed Trump on border security, but would vote for the resolution because he “cannot justify providing the executive with more ways to bypass Congress.”

Republican Senator Lisa Murkowski on Tuesday told reporters she would back the resolution. Previously, her Republican colleague, Susan Collins had said she likely would support the measure, too. For it to pass the Senate, at least one more Republican vote would be needed, assuming all Democrats and two independents back it.