Donald Trump’s emergency declaration over the US border with Mexico remained in force after the House failed to garner the two-thirds majority needed to overturn the president’s veto.

The House voted 248-181 on Tuesday to override Trump’s veto, the first of his presidency. Democrats succeeded in attracting 14 Republicans to join them in the effort, but still fell 38 votes short of their target.

The result was seized upon as yet another victory by Trump, who is already on a high after the special counsel Robert Mueller found no evidence of collusion between the Trump campaign and Russia. In a tweet, the president pronounced the vote to be a “BIG WIN” and repeated his caricature of the Democrats as the part of open borders, drugs and crime.

Donald J. Trump (@realDonaldTrump) Thank you to the House Republicans for sticking together and the BIG WIN today on the Border. Today’s vote simply reaffirms Congressional Democrats are the party of Open Borders, Drugs and Crime!

The two Democrats who wrote the resolution to override Trump’s veto, the House speaker, Nancy Pelosi, and Joaquin Castro, a congressman from Texas, denounced the emergency declaration as a “dangerous action” that violated the exclusive responsibility of Congress to set budgets. In a joint statement, they vowed to carry on striving to “restore our constitutional system of balance of powers”.

Trump resorted to the highly contentious move of triggering a national emergency declaration in February, following a five-week government shutdown over funding for the president’s much-vaunted border wall. The move provoked a rare display of disapproval towards the president from Republicans in both the House and Senate, who joined Democrats to pass a resolution that would have ended the national emergency, until the president vetoed the measure.

One of the Democrats’ main concerns was that Trump would use the national emergency to siphon off money from the military to pay for his wall. The first signs of that scenario materializing emerged on Monday night when the Department of Defense announced it had redirected $1bn in funding to allow some construction to go ahead.

Democrats immediately warned the reallocation of resources would worsen existing “substantial shortfalls” in defense spending.

Patrick Shanahan, the acting defense secretary, said the $1bn would go towards 57 miles of 18ft-high fencing and other measures along the border, CNN reported.

Sign up for the US morning briefing

In a letter to the homeland security secretary, Kirstjen Nielsen, Shanahan said he had authorized the Army Corps of Engineers to commence planning and construction of the wall near the Yuma and El Paso sections of the border, according to CNN.

America pays for the wall: thieves mock Trump by stealing border razor wire Read more

In a letter to Shanahan, a group of Democratic senators who sit on subcommittees on defense and military construction, veterans affairs and related agencies accused the Department of Homeland Security of allowing “political interference and pet projects to come ahead of many near-term, critical readiness issues facing our military”.

“We strongly object to both the substance of the funding transfer, and to the Department implementing the transfer without seeking the approval of the congressional defense committees and in violation of provisions in the defense appropriation itself,” the senators, including Tammy Baldwin, Dianne Feinstein and Richard Durbin, wrote.

“The $1bn reprogramming that the department is implementing without congressional approval constitutes a dollar-for-dollar theft from other readiness needs of our Armed Forces.”