By Susan Cornwell

WASHINGTON (Reuters) - The U.S. House of Representatives on Tuesday failed to override President Donald Trump's first veto, leaving in place the "national emergency" he declared last month to build a U.S.-Mexico border wall that Congress has not funded.

Democrats who control the House did not attract enough Republican support, falling some three dozen votes short of the two-thirds majority vote needed to overturn Trump's veto. Just 14 Republicans joined 234 Democrats in voting to override, one more Republican than had bucked Trump in a previous House vote on the border wall emergency. One Democrat and two Republicans did not vote.

With the 248-181 tally, Trump is now likely to continue scouring federal accounts for money he wants redirected to building a border wall, which he says is needed to curb illegal immigration and drug trafficking.

However, House Speaker Nancy Pelosi and Democratic Representative Joaquin Castro, author of the resolution to overturn Trump's move, said lawmakers would keep trying to block him through the regular congressional process of appropriating funds, as well as reviewing his emergency declaration again six months from now.

The battle over Trump's emergency declaration also shifts to the courts, with various legal challenges already underway that could slow Trump's building plans for some time. A coalition of 16 states sued in federal court in February to stop Trump's border wall emergency; another four states joined the lawsuit this month.

"Thank you to the House Republicans for sticking together and the BIG WIN today on the Border," Trump wrote on Twitter after the House vote. "Today's vote simply reaffirms Congressional Democrats are the party of Open Borders, Drugs and Crime!"

Trump declared the national emergency on Feb. 15 in an attempt to bypass Congress and move taxpayer funds for the wall away from other uses already approved by the legislature. Bipartisan majorities of both the House and Senate rejected his move, voting to terminate the emergency before the president vetoed their resolution on March 15.

Story continues

BYPASSING CONGRESS

Democrats argued the Republican president had overstepped his authority by going around Congress, because the legislature has the power to control spending under the U.S. Constitution.

"We take an oath to the Constitution, not to the president of the United States," Pelosi said on the House floor.

But Republicans insisted Trump had acted legally under a 1976 law known as the National Emergencies Act, under which previous presidents had declared dozens of emergencies.

"The president has the authority to act. The president is using the authority Congress has given him," said Republican Representative Sam Graves.

Trump's position was possibly strengthened by Special Counsel Robert Mueller's conclusion after a 22-month investigation that the Republican president's campaign team did not collude with Russian interference in the 2016 election. Moscow has denied meddling.

That political victory for Trump may make it more challenging for Republicans to defy the president on a range of things, including his signature issue, the border wall.

“Even though the two issues clearly aren’t related, it increases the president’s strength and popularity and puts him in a stronger position,” Republican Representative Tom Cole said before the House vote.

After the vote, Pelosi and Castro said in a statement that Congress would keep working through the appropriations process to "terminate this dangerous action" by the president.

Indeed, earlier Tuesday, the House Armed Services Committee sought to deny the Pentagon the authority to reprogram funds for the wall, an action that could potentially set up another courtroom battle.

The Pentagon had announced Monday that it was shifting $1 billion from military construction projects to build part of the wall. But Democratic Representative Adam Smith, the Armed Services Committee's chairman, said Tuesday the panel did not approve the proposed use of Pentagon funds.

The leader of the 20-state lawsuit to stop the border wall emergency, California Attorney General Xavier Becerra, said after the House failed to override Trump's veto that the states "are ready to fight long and hard to stop his (Trump's)fabricated emergency in its tracks."

For two years, Congress has refused to meet Trump's demands for funding the wall he promised in his 2016 election campaign, although it appropriated some funds for border fencing and other barriers.

This year, Trump sought $5.7 billion in wall funding. When Congress refused, the standoff triggered a month-long partial government shutdown. That ended when the president agreed to $1.37 billion for border barriers, far less than he wanted.

The president then declared the emergency, vowing to divert funds from other accounts for the wall.

(Reporting by Susan Cornwell; Additional reporting by David Morgan; Editing by Jonathan Oatis and Tom Brown)