Washington — An effort by Congressional Democrats to override President Trump's veto on a resolution that would have overturned his national emergency proclamation failed in the Democratic-controlled House on Tuesday.

The resolution's success in the House would've been a humiliating defeat for the administration. But Republican House leaders, who have been in lockstep with the White House since it issued the declaration in February, managed to limit the number of defectors among their ranks.

The measure needed support from two-thirds of the House to overturn the president's veto. It failed by a vote of 248 to 181, with only 14 Republicans breaking with the White House and voting with their Democratic colleagues.

The president praised Republican leadership for minimizing the number of defections and ensuring the measure's demise. "Thank you to the House Republicans for sticking together and the BIG WIN today on the Border," Mr. Trump wrote on Twitter late Tuesday afternoon. "Today's vote simply reaffirms Congressional Democrats are the party of Open Borders, Drugs and Crime!"

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! — Donald J. Trump (@realDonaldTrump) March 26, 2019

The Democratic-sponsored resolution to end the president's declaration, spearheaded by Texas Rep. Joaquin Castro, had passed in both the Senate and House with some Republican support, but it was vetoed by the president earlier this month.

Get Breaking News Delivered to Your Inbox

After Congress approved spending legislation with only $1.375 billion in funding for 55 miles of physical barriers along the U.S.-Mexico border in early February, the president declared a national emergency to unilaterally access billions of dollars in additional funds to build his long-promised border wall.

Responding to Tuesday's vote, House Speaker Nancy Pelosi and Castro noted that Mr. Trump's "sham" emergency declaration, which they said violated Congress' constitutional power of the purse, had been rejected by both the Democratic-controlled House and Republican-controlled Senate.

"In six months, the Congress will have another opportunity to put a stop to this President's wrongdoing," Pelosi and Castro wrote in a statement. "We will continue to review all options to protect our Constitution and our Democracy from the President's assault."

Mr. Trump's order still faces a formidable challenge in court. A coalition of attorneys general from 20 states, who called the White House's unprecedented move "unlawful and unconstitutional," sued Trump administration days after the proclamation was issued.

California's attorney general, Xavier Becerra, a vocal critic of the president who is leading the multi-state lawsuit against the emergency declaration, vowed to continue his legal challenge to the administration.

"President Trump can't take taxpayer dollars to build his wall without Congress's permission," he wrote in a statement Tuesday afternoon. "The 20 states standing with us in court are ready to fight long and hard to stop his fabricated emergency in its tracks."

CBS News' Rebecca Kaplan contributed to this report.