House Democrats on Tuesday failed to override President Trump’s first veto as part of their battle over border security, representing a victory for the administration that allows the president's declaration of a national emergency at the U.S.-Mexico border to stand.

The president had vetoed a Democrat-backed measure to cancel that emergency. The House voted 248-181 on Tuesday in favor of overriding – but this fell 38 votes short of the two-thirds majority needed. Only 14 Republicans voted in favor of the veto override.

The outcome of the vote, while not surprising, now enables Trump to move forward on an issue that was a hallmark of his 2016 presidential campaign and of his presidency. Yet the vote also gave Democrats a way to focus on policy differences with Trump, days after Attorney General William Barr gave the president a boost by saying Special Counsel Robert Mueller had found no evidence Trump's campaign colluded with Russia to influence the 2016 election.

TRUMP WILL SIGN BORDER SECURITY BILL, DECLARE NATIONAL EMERGENCY, WHITE HOUSE SAYS

Trump had declared the border emergency under a law that lets him shift budget funds to address dire situations. His plan is to shift an additional $3.6 billion from military construction projects to work on border barriers. Congress voted this year to limit spending on such barriers to less than $1.4 billion, and Democrats accused Trump of ignoring lawmakers' constitutional control over spending.

The failure to passs the veto override earned praise from trump, who in a tweet called it a "BIG WIN today on the border."

Trump's emergency declaration drew unanimous opposition from congressional Democrats and opposition from some Republicans, especially in the Senate, where critics objected that he was abusing presidential powers.

“Both chambers of Congress – a Democratic House and a Republican Senate – resoundingly rejected the President’s sham emergency declaration by passing H.J.Res.46," House Speaker Nancy Pelosi, D-Calif, and Rep. Joaquin Castro, D-Texas, said shortly after the vote in a joint statement. "The President’s lawless emergency declaration clearly violates the Congress’s exclusive power of the purse, and Congress will work through the appropriations and defense authorization processes to terminate this dangerous action and restore our constitutional system of balance of powers."

Republicans argue that Trump has merely acted under a 1976 law that lets presidents declare national emergencies. Trump's declaration was the 60th presidential emergency under that statute, but the first aimed at spending that Congress explicitly denied, according to New York University's Brennan Center for Justice, which tracks the law.

WHAT IS A 'NATIONAL EMERGENCY' AND HOW CAN TRUMP USE IT TO FUND THE BORDER WALL?

Rep. Tom McClintock, R-Calif., said Trump was acting against the "radical left in this House that would dissolve our borders entirely if given the chance" — a stance that no Democrat has taken — while Rep. Paul Mitchell, R-Mich., called the veto override effort "a partisan whack job" because of its certain defeat.

Even with his veto remaining intact, Trump may not be able to spend the money for barriers quickly because of lawsuits that might take years to resolve.

Democrats were hoping to use the border emergency battle in upcoming campaigns, both to symbolize Trump's harsh immigration stance and claim he was hurting congressional districts around the country.

The Pentagon sent lawmakers a list last week of hundreds of military construction projects that might be cut to pay for barrier work. Though the list was tentative, Democrats were asserting that GOP lawmakers were endangering local bases to pay for the wall.

CLICK HERE TO GET THE FOX NEWS APP

Congress, to which the Constitution assigned control over spending, voted weeks ago to provide less than $1.4 billion for barriers. Opponents warned that besides usurping Congress' role in making spending decisions, Trump was inviting future Democratic presidents to circumvent lawmakers by declaring emergencies to finance their own favored initiatives.

This month, the GOP-led Senate rebuked Trump with a 59-41 vote blocking his declaration after the failure of a Republican effort to reach a compromise with the White House. Republicans were hoping to avoid a confrontation with him for fear of alienating pro-Trump voters.

With the House override vote failing, the Senate won't attempt its own override and the veto will stand.

Fox News Chad Pergram and the Associated Press contributed to this report.